[Support] Remove unused includes (NFC) (#116752)
[llvm-project.git] / flang / runtime / stat.h
blob71faeb027d9085fc8ef2c1ed4525bc7c6e3b2a24
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/Common/api-attrs.h"
15 #include "flang/ISO_Fortran_binding_wrapper.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 StatMissingCurrentWorkDirectory = FORTRAN_RUNTIME_STAT_MISSING_CWD,
45 StatStoppedImage = FORTRAN_RUNTIME_STAT_STOPPED_IMAGE,
46 StatUnlocked = FORTRAN_RUNTIME_STAT_UNLOCKED,
47 StatUnlockedFailedImage = FORTRAN_RUNTIME_STAT_UNLOCKED_FAILED_IMAGE,
49 // Additional "processor-defined" STAT= values
50 StatInvalidArgumentNumber = FORTRAN_RUNTIME_STAT_INVALID_ARG_NUMBER,
51 StatMissingArgument = FORTRAN_RUNTIME_STAT_MISSING_ARG,
52 StatValueTooShort = FORTRAN_RUNTIME_STAT_VALUE_TOO_SHORT,
53 StatMoveAllocSameAllocatable =
54 FORTRAN_RUNTIME_STAT_MOVE_ALLOC_SAME_ALLOCATABLE,
55 StatBadPointerDeallocation = FORTRAN_RUNTIME_STAT_BAD_POINTER_DEALLOCATION,
58 RT_API_ATTRS const char *StatErrorString(int);
59 RT_API_ATTRS int ToErrmsg(const Descriptor *errmsg, int stat); // returns stat
60 RT_API_ATTRS int ReturnError(Terminator &, int stat,
61 const Descriptor *errmsg = nullptr, bool hasStat = false);
62 } // namespace Fortran::runtime
63 #endif // FORTRAN_RUNTIME_STAT_H