]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fortran/libgfortran.h
Update copyright years.
[thirdparty/gcc.git] / gcc / fortran / libgfortran.h
CommitLineData
d74b97cc 1/* Header file to the Fortran front-end and runtime library
818ab71a 2 Copyright (C) 2007-2016 Free Software Foundation, Inc.
d74b97cc
FXC
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20
21/* Flags to specify which standard/extension contains a feature.
9e0667cd
TB
22 Note that no features were obsoleted nor deleted in F2003.
23 Please remember to keep those definitions in sync with
24 gfortran.texi. */
1928ec50
MP
25/* For now, use F2015 = GFC_STD_GNU. */
26#define GFC_STD_F2015 (1<<5) /* PLACEHOLDER for Fortran 2015. */
4650947d 27#define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */
58fc89f6
TB
28#define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */
29#define GFC_STD_F2008 (1<<7) /* New in F2008. */
30#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
31#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
32#define GFC_STD_F2003 (1<<4) /* New in F2003. */
33#define GFC_STD_F95 (1<<3) /* New in F95. */
34#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
35#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
36#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
37 obsolescent in later standards. */
d74b97cc
FXC
38
39
8b198102
FXC
40/* Bitmasks for the various FPE that can be enabled. These need to be straight integers
41 e.g., 8 instead of (1<<3), because they will be included in Fortran source. */
42#define GFC_FPE_INVALID 1
43#define GFC_FPE_DENORMAL 2
44#define GFC_FPE_ZERO 4
45#define GFC_FPE_OVERFLOW 8
46#define GFC_FPE_UNDERFLOW 16
47#define GFC_FPE_INEXACT 32
d74b97cc 48
82a4f54c
TB
49/* Defines for floating-point rounding modes. */
50#define GFC_FPE_DOWNWARD 1
51#define GFC_FPE_TONEAREST 2
52#define GFC_FPE_TOWARDZERO 3
53#define GFC_FPE_UPWARD 4
54
8b198102
FXC
55/* Size of the buffer required to store FPU state for any target.
56 In particular, this has to be larger than fenv_t on all glibc targets.
57 Currently, the winner is x86_64 with 32 bytes. */
58#define GFC_FPE_STATE_BUFFER_SIZE 32
d74b97cc 59
d3d3011f
FXC
60/* Bitmasks for the various runtime checks that can be enabled. */
61#define GFC_RTCHECK_BOUNDS (1<<0)
62#define GFC_RTCHECK_ARRAY_TEMPS (1<<1)
63#define GFC_RTCHECK_RECURSION (1<<2)
64#define GFC_RTCHECK_DO (1<<3)
20460eb9 65#define GFC_RTCHECK_POINTER (1<<4)
22bdbb0f 66#define GFC_RTCHECK_MEM (1<<5)
d3d3011f 67#define GFC_RTCHECK_ALL (GFC_RTCHECK_BOUNDS | GFC_RTCHECK_ARRAY_TEMPS \
20460eb9 68 | GFC_RTCHECK_RECURSION | GFC_RTCHECK_DO \
22bdbb0f 69 | GFC_RTCHECK_POINTER | GFC_RTCHECK_MEM)
d3d3011f 70
e344505c
JD
71/* Special unit numbers used to convey certain conditions. Numbers -3
72 thru -9 available. NEWUNIT values start at -10. */
73#define GFC_INTERNAL_UNIT -1
74#define GFC_INVALID_UNIT -2
d3d3011f 75
d74b97cc 76/* Possible values for the CONVERT I/O specifier. */
f19626cf 77/* Keep in sync with GFC_FLAG_CONVERT_* in gcc/flags.h. */
d74b97cc
FXC
78typedef enum
79{
80 GFC_CONVERT_NONE = -1,
81 GFC_CONVERT_NATIVE = 0,
82 GFC_CONVERT_SWAP,
83 GFC_CONVERT_BIG,
84 GFC_CONVERT_LITTLE
85}
86unit_convert;
87
88
89/* Runtime errors. */
90typedef enum
91{
92 LIBERROR_FIRST = -3, /* Marker for the first error. */
93 LIBERROR_EOR = -2, /* End of record, must be negative. */
94 LIBERROR_END = -1, /* End of file, must be negative. */
95 LIBERROR_OK = 0, /* Indicates success, must be zero. */
96 LIBERROR_OS = 5000, /* OS error, more info in errno. */
97 LIBERROR_OPTION_CONFLICT,
98 LIBERROR_BAD_OPTION,
99 LIBERROR_MISSING_OPTION,
100 LIBERROR_ALREADY_OPEN,
101 LIBERROR_BAD_UNIT,
102 LIBERROR_FORMAT,
103 LIBERROR_BAD_ACTION,
104 LIBERROR_ENDFILE,
105 LIBERROR_BAD_US,
106 LIBERROR_READ_VALUE,
107 LIBERROR_READ_OVERFLOW,
108 LIBERROR_INTERNAL,
109 LIBERROR_INTERNAL_UNIT,
110 LIBERROR_ALLOCATION,
111 LIBERROR_DIRECT_EOR,
112 LIBERROR_SHORT_RECORD,
113 LIBERROR_CORRUPT_FILE,
be1f1ed9 114 LIBERROR_INQUIRE_INTERNAL_UNIT, /* Must be different from STAT_STOPPED_IMAGE. */
d74b97cc
FXC
115 LIBERROR_LAST /* Not a real error, the last error # + 1. */
116}
117libgfortran_error_codes;
118
60386f50 119/* Must kept in sync with libgfortrancaf.h. */
385e8144
TB
120typedef enum
121{
122 GFC_STAT_UNLOCKED = 0,
123 GFC_STAT_LOCKED,
124 GFC_STAT_LOCKED_OTHER_IMAGE,
7f4aaf91
TB
125 GFC_STAT_STOPPED_IMAGE = 6000, /* See LIBERROR_INQUIRE_INTERNAL_UNIT above. */
126 GFC_STAT_FAILED_IMAGE
385e8144
TB
127}
128libgfortran_stat_codes;
d74b97cc 129
42a8246d
TB
130typedef enum
131{
132 GFC_CAF_ATOMIC_ADD = 1,
133 GFC_CAF_ATOMIC_AND,
134 GFC_CAF_ATOMIC_OR,
135 GFC_CAF_ATOMIC_XOR
136} libcaf_atomic_codes;
137
229c5919
TB
138
139/* For CO_REDUCE. */
140#define GFC_CAF_BYREF (1<<0)
141#define GFC_CAF_HIDDENLEN (1<<1)
142#define GFC_CAF_ARG_VALUE (1<<2)
143#define GFC_CAF_ARG_DESC (1<<3)
144
145
d74b97cc
FXC
146/* Default unit number for preconnected standard input and output. */
147#define GFC_STDIN_UNIT_NUMBER 5
148#define GFC_STDOUT_UNIT_NUMBER 6
149#define GFC_STDERR_UNIT_NUMBER 0
150
151
6c397102
TB
152/* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
153 GFC_DTYPE_RANK_MASK. See PR 36825. */
154#define GFC_MAX_DIMENSIONS 7
d74b97cc
FXC
155
156#define GFC_DTYPE_RANK_MASK 0x07
157#define GFC_DTYPE_TYPE_SHIFT 3
158#define GFC_DTYPE_TYPE_MASK 0x38
159#define GFC_DTYPE_SIZE_SHIFT 6
160
a11930ba
JD
161/* Basic types. BT_VOID is used by ISO C Binding so funcs like c_f_pointer
162 can take any arg with the pointer attribute as a param. These are also
163 used in the run-time library for IO. */
ffa61a5e 164typedef enum
a11930ba 165{ BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
45a69325
TB
166 BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
167 BT_ASSUMED
ffa61a5e 168}
a11930ba 169bt;