1 //===-- runtime/stat.h ------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Defines the values returned by the runtime for STAT= specifiers
10 // on executable statements.
12 #ifndef FORTRAN_RUNTIME_STAT_H_
13 #define FORTRAN_RUNTIME_STAT_H_
14 #include "flang/ISO_Fortran_binding.h"
15 #include "flang/Runtime/magic-numbers.h"
16 namespace Fortran::runtime
{
21 // The value of STAT= is zero when no error condition has arisen.
24 StatOk
= 0, // required to be zero by Fortran
26 // Interoperable STAT= codes
27 StatBaseNull
= CFI_ERROR_BASE_ADDR_NULL
,
28 StatBaseNotNull
= CFI_ERROR_BASE_ADDR_NOT_NULL
,
29 StatInvalidElemLen
= CFI_INVALID_ELEM_LEN
,
30 StatInvalidRank
= CFI_INVALID_RANK
,
31 StatInvalidType
= CFI_INVALID_TYPE
,
32 StatInvalidAttribute
= CFI_INVALID_ATTRIBUTE
,
33 StatInvalidExtent
= CFI_INVALID_EXTENT
,
34 StatInvalidDescriptor
= CFI_INVALID_DESCRIPTOR
,
35 StatMemAllocation
= CFI_ERROR_MEM_ALLOCATION
,
36 StatOutOfBounds
= CFI_ERROR_OUT_OF_BOUNDS
,
38 // Standard STAT= values
39 StatFailedImage
= FORTRAN_RUNTIME_STAT_FAILED_IMAGE
,
40 StatLocked
= FORTRAN_RUNTIME_STAT_LOCKED
,
41 StatLockedOtherImage
= FORTRAN_RUNTIME_STAT_LOCKED_OTHER_IMAGE
,
42 StatMissingEnvVariable
= FORTRAN_RUNTIME_STAT_MISSING_ENV_VAR
,
43 StatStoppedImage
= FORTRAN_RUNTIME_STAT_STOPPED_IMAGE
,
44 StatUnlocked
= FORTRAN_RUNTIME_STAT_UNLOCKED
,
45 StatUnlockedFailedImage
= FORTRAN_RUNTIME_STAT_UNLOCKED_FAILED_IMAGE
,
47 // Additional "processor-defined" STAT= values
48 StatInvalidArgumentNumber
= FORTRAN_RUNTIME_STAT_INVALID_ARG_NUMBER
,
49 StatMissingArgument
= FORTRAN_RUNTIME_STAT_MISSING_ARG
,
50 StatValueTooShort
= FORTRAN_RUNTIME_STAT_VALUE_TOO_SHORT
,
53 const char *StatErrorString(int);
54 int ToErrmsg(const Descriptor
*errmsg
, int stat
); // returns stat
55 int ReturnError(Terminator
&, int stat
, const Descriptor
*errmsg
= nullptr,
56 bool hasStat
= false);
57 } // namespace Fortran::runtime
58 #endif // FORTRAN_RUNTIME_STAT_H