]>
Commit | Line | Data |
---|---|---|
3d6f7931 | 1 | /* Pragma related interfaces. |
83ffe9cd | 2 | Copyright (C) 1995-2023 Free Software Foundation, Inc. |
3d6f7931 | 3 | |
1322177d | 4 | This file is part of GCC. |
3d6f7931 | 5 | |
1322177d LB |
6 | GCC is free software; you can redistribute it and/or modify it under |
7 | the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 9 | version. |
3d6f7931 | 10 | |
1322177d LB |
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
3d6f7931 MM |
15 | |
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
3d6f7931 | 19 | |
88657302 RH |
20 | #ifndef GCC_C_PRAGMA_H |
21 | #define GCC_C_PRAGMA_H | |
f09db6e0 | 22 | |
71f3e391 | 23 | #include "cpplib.h" /* For enum cpp_ttype. */ |
f4086145 | 24 | |
bc4071dd | 25 | /* Pragma identifiers built in to the front end parsers. Identifiers |
c0220ea4 | 26 | for ancillary handlers will follow these. */ |
a79683d5 | 27 | enum pragma_kind { |
bc4071dd RH |
28 | PRAGMA_NONE = 0, |
29 | ||
4bf9e5a8 | 30 | PRAGMA_OACC_ATOMIC, |
41dbbb37 TS |
31 | PRAGMA_OACC_CACHE, |
32 | PRAGMA_OACC_DATA, | |
6e232ba4 | 33 | PRAGMA_OACC_DECLARE, |
41dbbb37 TS |
34 | PRAGMA_OACC_ENTER_DATA, |
35 | PRAGMA_OACC_EXIT_DATA, | |
37d5ad46 | 36 | PRAGMA_OACC_HOST_DATA, |
41dbbb37 TS |
37 | PRAGMA_OACC_KERNELS, |
38 | PRAGMA_OACC_LOOP, | |
39 | PRAGMA_OACC_PARALLEL, | |
3a40d81d | 40 | PRAGMA_OACC_ROUTINE, |
62aee289 | 41 | PRAGMA_OACC_SERIAL, |
41dbbb37 TS |
42 | PRAGMA_OACC_UPDATE, |
43 | PRAGMA_OACC_WAIT, | |
d9a6bd32 | 44 | |
2c5d803d | 45 | /* PRAGMA_OMP__START_ should be equal to the first PRAGMA_OMP_* code. */ |
aa043200 | 46 | PRAGMA_OMP_ALLOCATE, |
2c5d803d | 47 | PRAGMA_OMP__START_ = PRAGMA_OMP_ALLOCATE, |
4790fe99 JJ |
48 | PRAGMA_OMP_ASSUME, |
49 | PRAGMA_OMP_ASSUMES, | |
953ff289 DN |
50 | PRAGMA_OMP_ATOMIC, |
51 | PRAGMA_OMP_BARRIER, | |
4790fe99 | 52 | PRAGMA_OMP_BEGIN, |
acf0174b JJ |
53 | PRAGMA_OMP_CANCEL, |
54 | PRAGMA_OMP_CANCELLATION_POINT, | |
953ff289 | 55 | PRAGMA_OMP_CRITICAL, |
f9d8d994 | 56 | PRAGMA_OMP_DECLARE, |
28567c40 | 57 | PRAGMA_OMP_DEPOBJ, |
acf0174b | 58 | PRAGMA_OMP_DISTRIBUTE, |
0d973c0a | 59 | PRAGMA_OMP_ERROR, |
4790fe99 | 60 | PRAGMA_OMP_END, |
953ff289 DN |
61 | PRAGMA_OMP_FLUSH, |
62 | PRAGMA_OMP_FOR, | |
554a530f | 63 | PRAGMA_OMP_LOOP, |
5079b778 | 64 | PRAGMA_OMP_NOTHING, |
d0befed7 | 65 | PRAGMA_OMP_MASKED, |
953ff289 DN |
66 | PRAGMA_OMP_MASTER, |
67 | PRAGMA_OMP_ORDERED, | |
68 | PRAGMA_OMP_PARALLEL, | |
28567c40 | 69 | PRAGMA_OMP_REQUIRES, |
bf38f7e9 | 70 | PRAGMA_OMP_SCAN, |
e45483c7 | 71 | PRAGMA_OMP_SCOPE, |
953ff289 DN |
72 | PRAGMA_OMP_SECTION, |
73 | PRAGMA_OMP_SECTIONS, | |
acf0174b | 74 | PRAGMA_OMP_SIMD, |
953ff289 | 75 | PRAGMA_OMP_SINGLE, |
acf0174b | 76 | PRAGMA_OMP_TARGET, |
a68ab351 | 77 | PRAGMA_OMP_TASK, |
acf0174b | 78 | PRAGMA_OMP_TASKGROUP, |
d9a6bd32 | 79 | PRAGMA_OMP_TASKLOOP, |
a68ab351 | 80 | PRAGMA_OMP_TASKWAIT, |
20906c66 | 81 | PRAGMA_OMP_TASKYIELD, |
953ff289 | 82 | PRAGMA_OMP_THREADPRIVATE, |
acf0174b | 83 | PRAGMA_OMP_TEAMS, |
2c5d803d JJ |
84 | /* PRAGMA_OMP__LAST_ should be equal to the last PRAGMA_OMP_* code. */ |
85 | PRAGMA_OMP__LAST_ = PRAGMA_OMP_TEAMS, | |
953ff289 | 86 | |
bc4071dd | 87 | PRAGMA_GCC_PCH_PREPROCESS, |
8170608b | 88 | PRAGMA_IVDEP, |
170a8bd6 | 89 | PRAGMA_UNROLL, |
bc4071dd RH |
90 | |
91 | PRAGMA_FIRST_EXTERNAL | |
a79683d5 | 92 | }; |
bc4071dd | 93 | |
566c6181 | 94 | |
bbb7f860 | 95 | /* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0, 4.5, 5.0, |
0ccba4ed | 96 | 5.1 and 5.2. Used internally by both C and C++ parsers. */ |
a79683d5 | 97 | enum pragma_omp_clause { |
566c6181 ZW |
98 | PRAGMA_OMP_CLAUSE_NONE = 0, |
99 | ||
9a5de4d5 | 100 | PRAGMA_OMP_CLAUSE_AFFINITY, |
acf0174b | 101 | PRAGMA_OMP_CLAUSE_ALIGNED, |
3a8b2094 | 102 | PRAGMA_OMP_CLAUSE_ALLOCATE, |
554a530f | 103 | PRAGMA_OMP_CLAUSE_BIND, |
a68ab351 | 104 | PRAGMA_OMP_CLAUSE_COLLAPSE, |
566c6181 ZW |
105 | PRAGMA_OMP_CLAUSE_COPYIN, |
106 | PRAGMA_OMP_CLAUSE_COPYPRIVATE, | |
107 | PRAGMA_OMP_CLAUSE_DEFAULT, | |
d9a6bd32 | 108 | PRAGMA_OMP_CLAUSE_DEFAULTMAP, |
acf0174b | 109 | PRAGMA_OMP_CLAUSE_DEPEND, |
a6d22fb2 | 110 | PRAGMA_OMP_CLAUSE_DETACH, |
acf0174b | 111 | PRAGMA_OMP_CLAUSE_DEVICE, |
77eb117f | 112 | PRAGMA_OMP_CLAUSE_DEVICE_TYPE, |
acf0174b | 113 | PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, |
a651e6d5 | 114 | PRAGMA_OMP_CLAUSE_DOACROSS, |
0ccba4ed | 115 | PRAGMA_OMP_CLAUSE_ENTER, |
d0befed7 | 116 | PRAGMA_OMP_CLAUSE_FILTER, |
acf0174b | 117 | PRAGMA_OMP_CLAUSE_FINAL, |
566c6181 | 118 | PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, |
acf0174b JJ |
119 | PRAGMA_OMP_CLAUSE_FOR, |
120 | PRAGMA_OMP_CLAUSE_FROM, | |
d9a6bd32 | 121 | PRAGMA_OMP_CLAUSE_GRAINSIZE, |
bbb7f860 | 122 | PRAGMA_OMP_CLAUSE_HAS_DEVICE_ADDR, |
d9a6bd32 | 123 | PRAGMA_OMP_CLAUSE_HINT, |
566c6181 | 124 | PRAGMA_OMP_CLAUSE_IF, |
28567c40 | 125 | PRAGMA_OMP_CLAUSE_IN_REDUCTION, |
acf0174b | 126 | PRAGMA_OMP_CLAUSE_INBRANCH, |
d9a6bd32 | 127 | PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR, |
566c6181 | 128 | PRAGMA_OMP_CLAUSE_LASTPRIVATE, |
acf0174b | 129 | PRAGMA_OMP_CLAUSE_LINEAR, |
d9a6bd32 | 130 | PRAGMA_OMP_CLAUSE_LINK, |
acf0174b JJ |
131 | PRAGMA_OMP_CLAUSE_MAP, |
132 | PRAGMA_OMP_CLAUSE_MERGEABLE, | |
d9a6bd32 | 133 | PRAGMA_OMP_CLAUSE_NOGROUP, |
28567c40 | 134 | PRAGMA_OMP_CLAUSE_NONTEMPORAL, |
acf0174b | 135 | PRAGMA_OMP_CLAUSE_NOTINBRANCH, |
566c6181 | 136 | PRAGMA_OMP_CLAUSE_NOWAIT, |
d9a6bd32 | 137 | PRAGMA_OMP_CLAUSE_NUM_TASKS, |
acf0174b | 138 | PRAGMA_OMP_CLAUSE_NUM_TEAMS, |
566c6181 | 139 | PRAGMA_OMP_CLAUSE_NUM_THREADS, |
1fdd6f04 | 140 | PRAGMA_OMP_CLAUSE_ORDER, |
566c6181 | 141 | PRAGMA_OMP_CLAUSE_ORDERED, |
acf0174b | 142 | PRAGMA_OMP_CLAUSE_PARALLEL, |
d9a6bd32 | 143 | PRAGMA_OMP_CLAUSE_PRIORITY, |
566c6181 | 144 | PRAGMA_OMP_CLAUSE_PRIVATE, |
acf0174b | 145 | PRAGMA_OMP_CLAUSE_PROC_BIND, |
566c6181 | 146 | PRAGMA_OMP_CLAUSE_REDUCTION, |
acf0174b | 147 | PRAGMA_OMP_CLAUSE_SAFELEN, |
566c6181 | 148 | PRAGMA_OMP_CLAUSE_SCHEDULE, |
acf0174b | 149 | PRAGMA_OMP_CLAUSE_SECTIONS, |
a68ab351 | 150 | PRAGMA_OMP_CLAUSE_SHARED, |
d9a6bd32 | 151 | PRAGMA_OMP_CLAUSE_SIMD, |
acf0174b | 152 | PRAGMA_OMP_CLAUSE_SIMDLEN, |
28567c40 | 153 | PRAGMA_OMP_CLAUSE_TASK_REDUCTION, |
acf0174b JJ |
154 | PRAGMA_OMP_CLAUSE_TASKGROUP, |
155 | PRAGMA_OMP_CLAUSE_THREAD_LIMIT, | |
d9a6bd32 | 156 | PRAGMA_OMP_CLAUSE_THREADS, |
acf0174b JJ |
157 | PRAGMA_OMP_CLAUSE_TO, |
158 | PRAGMA_OMP_CLAUSE_UNIFORM, | |
41958c28 | 159 | PRAGMA_OMP_CLAUSE_UNTIED, |
d9a6bd32 | 160 | PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, |
398e3feb | 161 | PRAGMA_OMP_CLAUSE_USE_DEVICE_ADDR, |
d9a6bd32 | 162 | |
41dbbb37 | 163 | /* Clauses for OpenACC. */ |
5e9d6aa4 | 164 | PRAGMA_OACC_CLAUSE_ASYNC, |
519d7496 | 165 | PRAGMA_OACC_CLAUSE_ATTACH, |
41dbbb37 TS |
166 | PRAGMA_OACC_CLAUSE_AUTO, |
167 | PRAGMA_OACC_CLAUSE_COPY, | |
168 | PRAGMA_OACC_CLAUSE_COPYOUT, | |
169 | PRAGMA_OACC_CLAUSE_CREATE, | |
170 | PRAGMA_OACC_CLAUSE_DELETE, | |
171 | PRAGMA_OACC_CLAUSE_DEVICEPTR, | |
6e232ba4 | 172 | PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT, |
829c6349 | 173 | PRAGMA_OACC_CLAUSE_FINALIZE, |
41dbbb37 TS |
174 | PRAGMA_OACC_CLAUSE_GANG, |
175 | PRAGMA_OACC_CLAUSE_HOST, | |
7a5e4956 | 176 | PRAGMA_OACC_CLAUSE_INDEPENDENT, |
a6163563 | 177 | PRAGMA_OACC_CLAUSE_NO_CREATE, |
a61f6afb | 178 | PRAGMA_OACC_CLAUSE_NOHOST, |
41dbbb37 TS |
179 | PRAGMA_OACC_CLAUSE_NUM_GANGS, |
180 | PRAGMA_OACC_CLAUSE_NUM_WORKERS, | |
181 | PRAGMA_OACC_CLAUSE_PRESENT, | |
41dbbb37 TS |
182 | PRAGMA_OACC_CLAUSE_SELF, |
183 | PRAGMA_OACC_CLAUSE_SEQ, | |
7a5e4956 | 184 | PRAGMA_OACC_CLAUSE_TILE, |
41dbbb37 TS |
185 | PRAGMA_OACC_CLAUSE_VECTOR, |
186 | PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, | |
187 | PRAGMA_OACC_CLAUSE_WAIT, | |
188 | PRAGMA_OACC_CLAUSE_WORKER, | |
829c6349 | 189 | PRAGMA_OACC_CLAUSE_IF_PRESENT, |
41dbbb37 TS |
190 | PRAGMA_OACC_CLAUSE_COLLAPSE = PRAGMA_OMP_CLAUSE_COLLAPSE, |
191 | PRAGMA_OACC_CLAUSE_COPYIN = PRAGMA_OMP_CLAUSE_COPYIN, | |
192 | PRAGMA_OACC_CLAUSE_DEVICE = PRAGMA_OMP_CLAUSE_DEVICE, | |
7a5e4956 | 193 | PRAGMA_OACC_CLAUSE_DEFAULT = PRAGMA_OMP_CLAUSE_DEFAULT, |
a6d22fb2 | 194 | PRAGMA_OACC_CLAUSE_DETACH = PRAGMA_OMP_CLAUSE_DETACH, |
41dbbb37 TS |
195 | PRAGMA_OACC_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, |
196 | PRAGMA_OACC_CLAUSE_IF = PRAGMA_OMP_CLAUSE_IF, | |
197 | PRAGMA_OACC_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE, | |
6e232ba4 | 198 | PRAGMA_OACC_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION, |
398e3feb JJ |
199 | PRAGMA_OACC_CLAUSE_LINK = PRAGMA_OMP_CLAUSE_LINK, |
200 | PRAGMA_OACC_CLAUSE_USE_DEVICE = PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR | |
a79683d5 | 201 | }; |
c02065fc | 202 | |
81a75f0f NB |
203 | extern struct cpp_reader* parse_in; |
204 | ||
d7afec4b ND |
205 | /* It's safe to always leave visibility pragma enabled as if |
206 | visibility is not supported on the host OS platform the | |
207 | statements are ignored. */ | |
9789ba46 JJ |
208 | extern void push_visibility (const char *, int); |
209 | extern bool pop_visibility (int); | |
d7afec4b | 210 | |
5055d3a3 | 211 | extern void init_pragma (void); |
f09db6e0 | 212 | |
bc4071dd | 213 | /* Front-end wrappers for pragma registration. */ |
dfb43cd5 PV |
214 | typedef void (*pragma_handler_1arg)(struct cpp_reader *); |
215 | /* A second pragma handler, which adds a void * argument allowing to pass extra | |
216 | data to the handler. */ | |
217 | typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *); | |
218 | ||
219 | /* This union allows to abstract the different handlers. */ | |
220 | union gen_pragma_handler { | |
221 | pragma_handler_1arg handler_1arg; | |
222 | pragma_handler_2arg handler_2arg; | |
223 | }; | |
224 | /* Internally used to keep the data of the handler. */ | |
a79683d5 | 225 | struct internal_pragma_handler { |
e46f4d74 | 226 | union gen_pragma_handler handler, early_handler; |
dfb43cd5 PV |
227 | /* Permits to know if handler is a pragma_handler_1arg (extra_data is false) |
228 | or a pragma_handler_2arg (extra_data is true). */ | |
229 | bool extra_data; | |
230 | /* A data field which can be used when extra_data is true. */ | |
231 | void * data; | |
232 | }; | |
dfb43cd5 PV |
233 | |
234 | extern void c_register_pragma (const char *space, const char *name, | |
235 | pragma_handler_1arg handler); | |
236 | extern void c_register_pragma_with_data (const char *space, const char *name, | |
237 | pragma_handler_2arg handler, | |
238 | void *data); | |
239 | ||
240 | extern void c_register_pragma_with_expansion (const char *space, | |
241 | const char *name, | |
242 | pragma_handler_1arg handler); | |
243 | extern void c_register_pragma_with_expansion_and_data (const char *space, | |
244 | const char *name, | |
245 | pragma_handler_2arg handler, | |
246 | void *data); | |
bc4071dd RH |
247 | extern void c_invoke_pragma_handler (unsigned int); |
248 | ||
e46f4d74 LH |
249 | /* Early pragma handlers run in addition to the normal ones. They can be used |
250 | by frontends such as C++ that may want to process some pragmas during lexing | |
251 | before they start processing them. */ | |
252 | extern void | |
253 | c_register_pragma_with_early_handler (const char *space, const char *name, | |
254 | pragma_handler_1arg handler, | |
255 | pragma_handler_1arg early_handler); | |
256 | extern void c_invoke_early_pragma_handler (unsigned int); | |
257 | extern void c_pp_invoke_early_pragma_handler (unsigned int); | |
258 | ||
259 | ||
5055d3a3 | 260 | extern void maybe_apply_pragma_weak (tree); |
86f029aa | 261 | extern void maybe_apply_pending_pragma_weaks (void); |
5055d3a3 | 262 | extern tree maybe_apply_renaming_pragma (tree, tree); |
ee45a32d | 263 | extern void maybe_apply_pragma_scalar_storage_order (tree); |
5055d3a3 | 264 | extern void add_to_renaming_pragma_list (tree, tree); |
ecb0eece | 265 | |
c4914de6 | 266 | extern enum cpp_ttype pragma_lex (tree *, location_t *loc = NULL); |
bc4071dd | 267 | |
46c2514e TT |
268 | /* Flags for use with c_lex_with_flags. The values here were picked |
269 | so that 0 means to translate and join strings. */ | |
270 | #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into | |
271 | execution character set. */ | |
2c6e3f55 JJ |
272 | #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings |
273 | nor translate them into execution | |
274 | character set. */ | |
46c2514e | 275 | |
bc4071dd RH |
276 | /* This is not actually available to pragma parsers. It's merely a |
277 | convenient location to declare this function for c-lex, after | |
278 | having enum cpp_ttype declared. */ | |
46c2514e TT |
279 | extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *, |
280 | int); | |
c162c75e | 281 | |
a25a8f3b JJ |
282 | extern void c_pp_lookup_pragma (unsigned int, const char **, const char **); |
283 | ||
e50e723e TG |
284 | extern GTY(()) tree pragma_extern_prefix; |
285 | ||
88657302 | 286 | #endif /* GCC_C_PRAGMA_H */ |