]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/c-family/c-pragma.h
c-pragma.c (oacc_pragmas): Add entry for declare directive.
[thirdparty/gcc.git] / gcc / c-family / c-pragma.h
CommitLineData
3d6f7931 1/* Pragma related interfaces.
5624e564 2 Copyright (C) 1995-2015 Free Software Foundation, Inc.
3d6f7931 3
1322177d 4This file is part of GCC.
3d6f7931 5
1322177d
LB
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
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
3d6f7931 10
1322177d
LB
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.
3d6f7931
MM
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along 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 27enum 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,
36 PRAGMA_OACC_KERNELS,
37 PRAGMA_OACC_LOOP,
38 PRAGMA_OACC_PARALLEL,
3a40d81d 39 PRAGMA_OACC_ROUTINE,
41dbbb37
TS
40 PRAGMA_OACC_UPDATE,
41 PRAGMA_OACC_WAIT,
d9a6bd32 42
953ff289
DN
43 PRAGMA_OMP_ATOMIC,
44 PRAGMA_OMP_BARRIER,
acf0174b
JJ
45 PRAGMA_OMP_CANCEL,
46 PRAGMA_OMP_CANCELLATION_POINT,
953ff289 47 PRAGMA_OMP_CRITICAL,
acf0174b
JJ
48 PRAGMA_OMP_DECLARE_REDUCTION,
49 PRAGMA_OMP_DISTRIBUTE,
50 PRAGMA_OMP_END_DECLARE_TARGET,
953ff289
DN
51 PRAGMA_OMP_FLUSH,
52 PRAGMA_OMP_FOR,
53 PRAGMA_OMP_MASTER,
54 PRAGMA_OMP_ORDERED,
55 PRAGMA_OMP_PARALLEL,
953ff289
DN
56 PRAGMA_OMP_SECTION,
57 PRAGMA_OMP_SECTIONS,
acf0174b 58 PRAGMA_OMP_SIMD,
953ff289 59 PRAGMA_OMP_SINGLE,
acf0174b 60 PRAGMA_OMP_TARGET,
a68ab351 61 PRAGMA_OMP_TASK,
acf0174b 62 PRAGMA_OMP_TASKGROUP,
d9a6bd32 63 PRAGMA_OMP_TASKLOOP,
a68ab351 64 PRAGMA_OMP_TASKWAIT,
20906c66 65 PRAGMA_OMP_TASKYIELD,
953ff289 66 PRAGMA_OMP_THREADPRIVATE,
acf0174b 67 PRAGMA_OMP_TEAMS,
953ff289 68
c02065fc
AH
69 /* Top level clause to handle all Cilk Plus pragma simd clauses. */
70 PRAGMA_CILK_SIMD,
71
9a771876
JJ
72 /* This pragma handles setting of grainsize for a _Cilk_for. */
73 PRAGMA_CILK_GRAINSIZE,
74
bc4071dd 75 PRAGMA_GCC_PCH_PREPROCESS,
8170608b 76 PRAGMA_IVDEP,
bc4071dd
RH
77
78 PRAGMA_FIRST_EXTERNAL
a79683d5 79};
bc4071dd 80
566c6181 81
d9a6bd32 82/* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0 and 4.5.
566c6181 83 Used internally by both C and C++ parsers. */
a79683d5 84enum pragma_omp_clause {
566c6181
ZW
85 PRAGMA_OMP_CLAUSE_NONE = 0,
86
acf0174b 87 PRAGMA_OMP_CLAUSE_ALIGNED,
a68ab351 88 PRAGMA_OMP_CLAUSE_COLLAPSE,
566c6181
ZW
89 PRAGMA_OMP_CLAUSE_COPYIN,
90 PRAGMA_OMP_CLAUSE_COPYPRIVATE,
91 PRAGMA_OMP_CLAUSE_DEFAULT,
d9a6bd32 92 PRAGMA_OMP_CLAUSE_DEFAULTMAP,
acf0174b
JJ
93 PRAGMA_OMP_CLAUSE_DEPEND,
94 PRAGMA_OMP_CLAUSE_DEVICE,
95 PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
96 PRAGMA_OMP_CLAUSE_FINAL,
566c6181 97 PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
acf0174b
JJ
98 PRAGMA_OMP_CLAUSE_FOR,
99 PRAGMA_OMP_CLAUSE_FROM,
d9a6bd32
JJ
100 PRAGMA_OMP_CLAUSE_GRAINSIZE,
101 PRAGMA_OMP_CLAUSE_HINT,
566c6181 102 PRAGMA_OMP_CLAUSE_IF,
acf0174b 103 PRAGMA_OMP_CLAUSE_INBRANCH,
d9a6bd32 104 PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR,
566c6181 105 PRAGMA_OMP_CLAUSE_LASTPRIVATE,
acf0174b 106 PRAGMA_OMP_CLAUSE_LINEAR,
d9a6bd32 107 PRAGMA_OMP_CLAUSE_LINK,
acf0174b
JJ
108 PRAGMA_OMP_CLAUSE_MAP,
109 PRAGMA_OMP_CLAUSE_MERGEABLE,
d9a6bd32 110 PRAGMA_OMP_CLAUSE_NOGROUP,
acf0174b 111 PRAGMA_OMP_CLAUSE_NOTINBRANCH,
566c6181 112 PRAGMA_OMP_CLAUSE_NOWAIT,
d9a6bd32 113 PRAGMA_OMP_CLAUSE_NUM_TASKS,
acf0174b 114 PRAGMA_OMP_CLAUSE_NUM_TEAMS,
566c6181
ZW
115 PRAGMA_OMP_CLAUSE_NUM_THREADS,
116 PRAGMA_OMP_CLAUSE_ORDERED,
acf0174b 117 PRAGMA_OMP_CLAUSE_PARALLEL,
d9a6bd32 118 PRAGMA_OMP_CLAUSE_PRIORITY,
566c6181 119 PRAGMA_OMP_CLAUSE_PRIVATE,
acf0174b 120 PRAGMA_OMP_CLAUSE_PROC_BIND,
566c6181 121 PRAGMA_OMP_CLAUSE_REDUCTION,
acf0174b 122 PRAGMA_OMP_CLAUSE_SAFELEN,
566c6181 123 PRAGMA_OMP_CLAUSE_SCHEDULE,
acf0174b 124 PRAGMA_OMP_CLAUSE_SECTIONS,
a68ab351 125 PRAGMA_OMP_CLAUSE_SHARED,
d9a6bd32 126 PRAGMA_OMP_CLAUSE_SIMD,
acf0174b
JJ
127 PRAGMA_OMP_CLAUSE_SIMDLEN,
128 PRAGMA_OMP_CLAUSE_TASKGROUP,
129 PRAGMA_OMP_CLAUSE_THREAD_LIMIT,
d9a6bd32 130 PRAGMA_OMP_CLAUSE_THREADS,
acf0174b
JJ
131 PRAGMA_OMP_CLAUSE_TO,
132 PRAGMA_OMP_CLAUSE_UNIFORM,
41958c28 133 PRAGMA_OMP_CLAUSE_UNTIED,
d9a6bd32
JJ
134 PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR,
135
41958c28
BI
136 /* Clauses for Cilk Plus SIMD-enabled function. */
137 PRAGMA_CILK_CLAUSE_NOMASK,
138 PRAGMA_CILK_CLAUSE_MASK,
c02065fc 139 PRAGMA_CILK_CLAUSE_VECTORLENGTH,
41958c28
BI
140 PRAGMA_CILK_CLAUSE_NONE = PRAGMA_OMP_CLAUSE_NONE,
141 PRAGMA_CILK_CLAUSE_LINEAR = PRAGMA_OMP_CLAUSE_LINEAR,
142 PRAGMA_CILK_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE,
143 PRAGMA_CILK_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
144 PRAGMA_CILK_CLAUSE_LASTPRIVATE = PRAGMA_OMP_CLAUSE_LASTPRIVATE,
145 PRAGMA_CILK_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION,
41dbbb37
TS
146 PRAGMA_CILK_CLAUSE_UNIFORM = PRAGMA_OMP_CLAUSE_UNIFORM,
147
148 /* Clauses for OpenACC. */
149 PRAGMA_OACC_CLAUSE_ASYNC = PRAGMA_CILK_CLAUSE_VECTORLENGTH + 1,
150 PRAGMA_OACC_CLAUSE_AUTO,
151 PRAGMA_OACC_CLAUSE_COPY,
152 PRAGMA_OACC_CLAUSE_COPYOUT,
153 PRAGMA_OACC_CLAUSE_CREATE,
154 PRAGMA_OACC_CLAUSE_DELETE,
155 PRAGMA_OACC_CLAUSE_DEVICEPTR,
6e232ba4 156 PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT,
41dbbb37
TS
157 PRAGMA_OACC_CLAUSE_GANG,
158 PRAGMA_OACC_CLAUSE_HOST,
7a5e4956 159 PRAGMA_OACC_CLAUSE_INDEPENDENT,
41dbbb37
TS
160 PRAGMA_OACC_CLAUSE_NUM_GANGS,
161 PRAGMA_OACC_CLAUSE_NUM_WORKERS,
162 PRAGMA_OACC_CLAUSE_PRESENT,
163 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
164 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
165 PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
166 PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE,
167 PRAGMA_OACC_CLAUSE_SELF,
168 PRAGMA_OACC_CLAUSE_SEQ,
7a5e4956 169 PRAGMA_OACC_CLAUSE_TILE,
41dbbb37
TS
170 PRAGMA_OACC_CLAUSE_VECTOR,
171 PRAGMA_OACC_CLAUSE_VECTOR_LENGTH,
172 PRAGMA_OACC_CLAUSE_WAIT,
173 PRAGMA_OACC_CLAUSE_WORKER,
174 PRAGMA_OACC_CLAUSE_COLLAPSE = PRAGMA_OMP_CLAUSE_COLLAPSE,
175 PRAGMA_OACC_CLAUSE_COPYIN = PRAGMA_OMP_CLAUSE_COPYIN,
176 PRAGMA_OACC_CLAUSE_DEVICE = PRAGMA_OMP_CLAUSE_DEVICE,
7a5e4956 177 PRAGMA_OACC_CLAUSE_DEFAULT = PRAGMA_OMP_CLAUSE_DEFAULT,
41dbbb37
TS
178 PRAGMA_OACC_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
179 PRAGMA_OACC_CLAUSE_IF = PRAGMA_OMP_CLAUSE_IF,
180 PRAGMA_OACC_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE,
6e232ba4
JN
181 PRAGMA_OACC_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION,
182 PRAGMA_OACC_CLAUSE_LINK = PRAGMA_OMP_CLAUSE_LINK
a79683d5 183};
c02065fc 184
81a75f0f
NB
185extern struct cpp_reader* parse_in;
186
d7afec4b
ND
187/* It's safe to always leave visibility pragma enabled as if
188 visibility is not supported on the host OS platform the
189 statements are ignored. */
9789ba46
JJ
190extern void push_visibility (const char *, int);
191extern bool pop_visibility (int);
d7afec4b 192
5055d3a3 193extern void init_pragma (void);
f09db6e0 194
bc4071dd 195/* Front-end wrappers for pragma registration. */
dfb43cd5
PV
196typedef void (*pragma_handler_1arg)(struct cpp_reader *);
197/* A second pragma handler, which adds a void * argument allowing to pass extra
198 data to the handler. */
199typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *);
200
201/* This union allows to abstract the different handlers. */
202union gen_pragma_handler {
203 pragma_handler_1arg handler_1arg;
204 pragma_handler_2arg handler_2arg;
205};
206/* Internally used to keep the data of the handler. */
a79683d5 207struct internal_pragma_handler {
dfb43cd5
PV
208 union gen_pragma_handler handler;
209 /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
210 or a pragma_handler_2arg (extra_data is true). */
211 bool extra_data;
212 /* A data field which can be used when extra_data is true. */
213 void * data;
214};
dfb43cd5
PV
215
216extern void c_register_pragma (const char *space, const char *name,
217 pragma_handler_1arg handler);
218extern void c_register_pragma_with_data (const char *space, const char *name,
219 pragma_handler_2arg handler,
220 void *data);
221
222extern void c_register_pragma_with_expansion (const char *space,
223 const char *name,
224 pragma_handler_1arg handler);
225extern void c_register_pragma_with_expansion_and_data (const char *space,
226 const char *name,
227 pragma_handler_2arg handler,
228 void *data);
bc4071dd
RH
229extern void c_invoke_pragma_handler (unsigned int);
230
5055d3a3 231extern void maybe_apply_pragma_weak (tree);
86f029aa 232extern void maybe_apply_pending_pragma_weaks (void);
5055d3a3 233extern tree maybe_apply_renaming_pragma (tree, tree);
ee45a32d 234extern void maybe_apply_pragma_scalar_storage_order (tree);
5055d3a3 235extern void add_to_renaming_pragma_list (tree, tree);
ecb0eece 236
c4914de6 237extern enum cpp_ttype pragma_lex (tree *, location_t *loc = NULL);
bc4071dd 238
46c2514e
TT
239/* Flags for use with c_lex_with_flags. The values here were picked
240 so that 0 means to translate and join strings. */
241#define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
242 execution character set. */
2c6e3f55
JJ
243#define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
244 nor translate them into execution
245 character set. */
46c2514e 246
bc4071dd
RH
247/* This is not actually available to pragma parsers. It's merely a
248 convenient location to declare this function for c-lex, after
249 having enum cpp_ttype declared. */
46c2514e
TT
250extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
251 int);
c162c75e 252
a25a8f3b
JJ
253extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
254
e50e723e
TG
255extern GTY(()) tree pragma_extern_prefix;
256
88657302 257#endif /* GCC_C_PRAGMA_H */