Daily bump.
[official-gcc.git] / gcc / c-family / c-pragma.h
blobb9f09ba9f98a78d0b743b56ab4b8d0fb804fb151
1 /* Pragma related interfaces.
2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
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
8 Software Foundation; either version 3, or (at your option) any later
9 version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_C_PRAGMA_H
21 #define GCC_C_PRAGMA_H
23 #include "cpplib.h" /* For enum cpp_ttype. */
25 /* Pragma identifiers built in to the front end parsers. Identifiers
26 for ancillary handlers will follow these. */
27 typedef enum pragma_kind {
28 PRAGMA_NONE = 0,
30 PRAGMA_OMP_ATOMIC,
31 PRAGMA_OMP_BARRIER,
32 PRAGMA_OMP_CANCEL,
33 PRAGMA_OMP_CANCELLATION_POINT,
34 PRAGMA_OMP_CRITICAL,
35 PRAGMA_OMP_DECLARE_REDUCTION,
36 PRAGMA_OMP_DISTRIBUTE,
37 PRAGMA_OMP_END_DECLARE_TARGET,
38 PRAGMA_OMP_FLUSH,
39 PRAGMA_OMP_FOR,
40 PRAGMA_OMP_MASTER,
41 PRAGMA_OMP_ORDERED,
42 PRAGMA_OMP_PARALLEL,
43 PRAGMA_OMP_SECTION,
44 PRAGMA_OMP_SECTIONS,
45 PRAGMA_OMP_SIMD,
46 PRAGMA_OMP_SINGLE,
47 PRAGMA_OMP_TARGET,
48 PRAGMA_OMP_TASK,
49 PRAGMA_OMP_TASKGROUP,
50 PRAGMA_OMP_TASKWAIT,
51 PRAGMA_OMP_TASKYIELD,
52 PRAGMA_OMP_THREADPRIVATE,
53 PRAGMA_OMP_TEAMS,
55 /* Top level clause to handle all Cilk Plus pragma simd clauses. */
56 PRAGMA_CILK_SIMD,
58 /* This pragma handles setting of grainsize for a _Cilk_for. */
59 PRAGMA_CILK_GRAINSIZE,
61 PRAGMA_GCC_PCH_PREPROCESS,
62 PRAGMA_IVDEP,
64 PRAGMA_FIRST_EXTERNAL
65 } pragma_kind;
68 /* All clauses defined by OpenMP 2.5, 3.0, 3.1 and 4.0.
69 Used internally by both C and C++ parsers. */
70 typedef enum pragma_omp_clause {
71 PRAGMA_OMP_CLAUSE_NONE = 0,
73 PRAGMA_OMP_CLAUSE_ALIGNED,
74 PRAGMA_OMP_CLAUSE_COLLAPSE,
75 PRAGMA_OMP_CLAUSE_COPYIN,
76 PRAGMA_OMP_CLAUSE_COPYPRIVATE,
77 PRAGMA_OMP_CLAUSE_DEFAULT,
78 PRAGMA_OMP_CLAUSE_DEPEND,
79 PRAGMA_OMP_CLAUSE_DEVICE,
80 PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
81 PRAGMA_OMP_CLAUSE_FINAL,
82 PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
83 PRAGMA_OMP_CLAUSE_FOR,
84 PRAGMA_OMP_CLAUSE_FROM,
85 PRAGMA_OMP_CLAUSE_IF,
86 PRAGMA_OMP_CLAUSE_INBRANCH,
87 PRAGMA_OMP_CLAUSE_LASTPRIVATE,
88 PRAGMA_OMP_CLAUSE_LINEAR,
89 PRAGMA_OMP_CLAUSE_MAP,
90 PRAGMA_OMP_CLAUSE_MERGEABLE,
91 PRAGMA_OMP_CLAUSE_NOTINBRANCH,
92 PRAGMA_OMP_CLAUSE_NOWAIT,
93 PRAGMA_OMP_CLAUSE_NUM_TEAMS,
94 PRAGMA_OMP_CLAUSE_NUM_THREADS,
95 PRAGMA_OMP_CLAUSE_ORDERED,
96 PRAGMA_OMP_CLAUSE_PARALLEL,
97 PRAGMA_OMP_CLAUSE_PRIVATE,
98 PRAGMA_OMP_CLAUSE_PROC_BIND,
99 PRAGMA_OMP_CLAUSE_REDUCTION,
100 PRAGMA_OMP_CLAUSE_SAFELEN,
101 PRAGMA_OMP_CLAUSE_SCHEDULE,
102 PRAGMA_OMP_CLAUSE_SECTIONS,
103 PRAGMA_OMP_CLAUSE_SHARED,
104 PRAGMA_OMP_CLAUSE_SIMDLEN,
105 PRAGMA_OMP_CLAUSE_TASKGROUP,
106 PRAGMA_OMP_CLAUSE_THREAD_LIMIT,
107 PRAGMA_OMP_CLAUSE_TO,
108 PRAGMA_OMP_CLAUSE_UNIFORM,
109 PRAGMA_OMP_CLAUSE_UNTIED,
111 /* Clauses for Cilk Plus SIMD-enabled function. */
112 PRAGMA_CILK_CLAUSE_NOMASK,
113 PRAGMA_CILK_CLAUSE_MASK,
114 PRAGMA_CILK_CLAUSE_VECTORLENGTH,
115 PRAGMA_CILK_CLAUSE_NONE = PRAGMA_OMP_CLAUSE_NONE,
116 PRAGMA_CILK_CLAUSE_LINEAR = PRAGMA_OMP_CLAUSE_LINEAR,
117 PRAGMA_CILK_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE,
118 PRAGMA_CILK_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
119 PRAGMA_CILK_CLAUSE_LASTPRIVATE = PRAGMA_OMP_CLAUSE_LASTPRIVATE,
120 PRAGMA_CILK_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION,
121 PRAGMA_CILK_CLAUSE_UNIFORM = PRAGMA_OMP_CLAUSE_UNIFORM
122 } pragma_omp_clause;
124 extern struct cpp_reader* parse_in;
126 /* It's safe to always leave visibility pragma enabled as if
127 visibility is not supported on the host OS platform the
128 statements are ignored. */
129 extern void push_visibility (const char *, int);
130 extern bool pop_visibility (int);
132 extern void init_pragma (void);
134 /* Front-end wrappers for pragma registration. */
135 typedef void (*pragma_handler_1arg)(struct cpp_reader *);
136 /* A second pragma handler, which adds a void * argument allowing to pass extra
137 data to the handler. */
138 typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *);
140 /* This union allows to abstract the different handlers. */
141 union gen_pragma_handler {
142 pragma_handler_1arg handler_1arg;
143 pragma_handler_2arg handler_2arg;
145 /* Internally used to keep the data of the handler. */
146 struct internal_pragma_handler_d {
147 union gen_pragma_handler handler;
148 /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
149 or a pragma_handler_2arg (extra_data is true). */
150 bool extra_data;
151 /* A data field which can be used when extra_data is true. */
152 void * data;
154 typedef struct internal_pragma_handler_d internal_pragma_handler;
156 extern void c_register_pragma (const char *space, const char *name,
157 pragma_handler_1arg handler);
158 extern void c_register_pragma_with_data (const char *space, const char *name,
159 pragma_handler_2arg handler,
160 void *data);
162 extern void c_register_pragma_with_expansion (const char *space,
163 const char *name,
164 pragma_handler_1arg handler);
165 extern void c_register_pragma_with_expansion_and_data (const char *space,
166 const char *name,
167 pragma_handler_2arg handler,
168 void *data);
169 extern void c_invoke_pragma_handler (unsigned int);
171 extern void maybe_apply_pragma_weak (tree);
172 extern void maybe_apply_pending_pragma_weaks (void);
173 extern tree maybe_apply_renaming_pragma (tree, tree);
174 extern void add_to_renaming_pragma_list (tree, tree);
176 extern enum cpp_ttype pragma_lex (tree *);
178 /* Flags for use with c_lex_with_flags. The values here were picked
179 so that 0 means to translate and join strings. */
180 #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
181 execution character set. */
182 #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
183 nor translate them into execution
184 character set. */
186 /* This is not actually available to pragma parsers. It's merely a
187 convenient location to declare this function for c-lex, after
188 having enum cpp_ttype declared. */
189 extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
190 int);
192 extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
194 extern GTY(()) tree pragma_extern_prefix;
196 #endif /* GCC_C_PRAGMA_H */