[Docs][llvm-exegesis] Minor adjustments for clarity
[llvm-project.git] / flang / runtime / stat.h
blobe2b0658b122c972f63d4a319bf6949a14b5ba3c0
1 //===-- runtime/stat.h ------------------------------------------*- C++ -*-===//
2 //
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
6 //
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_wrapper.h"
15 #include "flang/Runtime/api-attrs.h"
16 #include "flang/Runtime/magic-numbers.h"
17 namespace Fortran::runtime {
19 class Descriptor;
20 class Terminator;
22 // The value of STAT= is zero when no error condition has arisen.
24 enum Stat {
25 StatOk = 0, // required to be zero by Fortran
27 // Interoperable STAT= codes
28 StatBaseNull = CFI_ERROR_BASE_ADDR_NULL,
29 StatBaseNotNull = CFI_ERROR_BASE_ADDR_NOT_NULL,
30 StatInvalidElemLen = CFI_INVALID_ELEM_LEN,
31 StatInvalidRank = CFI_INVALID_RANK,
32 StatInvalidType = CFI_INVALID_TYPE,
33 StatInvalidAttribute = CFI_INVALID_ATTRIBUTE,
34 StatInvalidExtent = CFI_INVALID_EXTENT,
35 StatInvalidDescriptor = CFI_INVALID_DESCRIPTOR,
36 StatMemAllocation = CFI_ERROR_MEM_ALLOCATION,
37 StatOutOfBounds = CFI_ERROR_OUT_OF_BOUNDS,
39 // Standard STAT= values
40 StatFailedImage = FORTRAN_RUNTIME_STAT_FAILED_IMAGE,
41 StatLocked = FORTRAN_RUNTIME_STAT_LOCKED,
42 StatLockedOtherImage = FORTRAN_RUNTIME_STAT_LOCKED_OTHER_IMAGE,
43 StatMissingEnvVariable = FORTRAN_RUNTIME_STAT_MISSING_ENV_VAR,
44 StatStoppedImage = FORTRAN_RUNTIME_STAT_STOPPED_IMAGE,
45 StatUnlocked = FORTRAN_RUNTIME_STAT_UNLOCKED,
46 StatUnlockedFailedImage = FORTRAN_RUNTIME_STAT_UNLOCKED_FAILED_IMAGE,
48 // Additional "processor-defined" STAT= values
49 StatInvalidArgumentNumber = FORTRAN_RUNTIME_STAT_INVALID_ARG_NUMBER,
50 StatMissingArgument = FORTRAN_RUNTIME_STAT_MISSING_ARG,
51 StatValueTooShort = FORTRAN_RUNTIME_STAT_VALUE_TOO_SHORT,
52 StatMoveAllocSameAllocatable =
53 FORTRAN_RUNTIME_STAT_MOVE_ALLOC_SAME_ALLOCATABLE,
56 RT_API_ATTRS const char *StatErrorString(int);
57 RT_API_ATTRS int ToErrmsg(const Descriptor *errmsg, int stat); // returns stat
58 RT_API_ATTRS int ReturnError(Terminator &, int stat,
59 const Descriptor *errmsg = nullptr, bool hasStat = false);
60 } // namespace Fortran::runtime
61 #endif // FORTRAN_RUNTIME_STAT_H