1 /* Pragma related interfaces.
2 Copyright (C) 1995-2013 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
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
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
{
33 PRAGMA_OMP_CANCELLATION_POINT
,
35 PRAGMA_OMP_DECLARE_REDUCTION
,
36 PRAGMA_OMP_DISTRIBUTE
,
37 PRAGMA_OMP_END_DECLARE_TARGET
,
52 PRAGMA_OMP_THREADPRIVATE
,
55 PRAGMA_GCC_PCH_PREPROCESS
,
62 /* All clauses defined by OpenMP 2.5, 3.0, 3.1 and 4.0.
63 Used internally by both C and C++ parsers. */
64 typedef enum pragma_omp_clause
{
65 PRAGMA_OMP_CLAUSE_NONE
= 0,
67 PRAGMA_OMP_CLAUSE_ALIGNED
,
68 PRAGMA_OMP_CLAUSE_COLLAPSE
,
69 PRAGMA_OMP_CLAUSE_COPYIN
,
70 PRAGMA_OMP_CLAUSE_COPYPRIVATE
,
71 PRAGMA_OMP_CLAUSE_DEFAULT
,
72 PRAGMA_OMP_CLAUSE_DEPEND
,
73 PRAGMA_OMP_CLAUSE_DEVICE
,
74 PRAGMA_OMP_CLAUSE_DIST_SCHEDULE
,
75 PRAGMA_OMP_CLAUSE_FINAL
,
76 PRAGMA_OMP_CLAUSE_FIRSTPRIVATE
,
77 PRAGMA_OMP_CLAUSE_FOR
,
78 PRAGMA_OMP_CLAUSE_FROM
,
80 PRAGMA_OMP_CLAUSE_INBRANCH
,
81 PRAGMA_OMP_CLAUSE_LASTPRIVATE
,
82 PRAGMA_OMP_CLAUSE_LINEAR
,
83 PRAGMA_OMP_CLAUSE_MAP
,
84 PRAGMA_OMP_CLAUSE_MERGEABLE
,
85 PRAGMA_OMP_CLAUSE_NOTINBRANCH
,
86 PRAGMA_OMP_CLAUSE_NOWAIT
,
87 PRAGMA_OMP_CLAUSE_NUM_TEAMS
,
88 PRAGMA_OMP_CLAUSE_NUM_THREADS
,
89 PRAGMA_OMP_CLAUSE_ORDERED
,
90 PRAGMA_OMP_CLAUSE_PARALLEL
,
91 PRAGMA_OMP_CLAUSE_PRIVATE
,
92 PRAGMA_OMP_CLAUSE_PROC_BIND
,
93 PRAGMA_OMP_CLAUSE_REDUCTION
,
94 PRAGMA_OMP_CLAUSE_SAFELEN
,
95 PRAGMA_OMP_CLAUSE_SCHEDULE
,
96 PRAGMA_OMP_CLAUSE_SECTIONS
,
97 PRAGMA_OMP_CLAUSE_SHARED
,
98 PRAGMA_OMP_CLAUSE_SIMDLEN
,
99 PRAGMA_OMP_CLAUSE_TASKGROUP
,
100 PRAGMA_OMP_CLAUSE_THREAD_LIMIT
,
101 PRAGMA_OMP_CLAUSE_TO
,
102 PRAGMA_OMP_CLAUSE_UNIFORM
,
103 PRAGMA_OMP_CLAUSE_UNTIED
106 extern struct cpp_reader
* parse_in
;
108 /* It's safe to always leave visibility pragma enabled as if
109 visibility is not supported on the host OS platform the
110 statements are ignored. */
111 extern void push_visibility (const char *, int);
112 extern bool pop_visibility (int);
114 extern void init_pragma (void);
116 /* Front-end wrappers for pragma registration. */
117 typedef void (*pragma_handler_1arg
)(struct cpp_reader
*);
118 /* A second pragma handler, which adds a void * argument allowing to pass extra
119 data to the handler. */
120 typedef void (*pragma_handler_2arg
)(struct cpp_reader
*, void *);
122 /* This union allows to abstract the different handlers. */
123 union gen_pragma_handler
{
124 pragma_handler_1arg handler_1arg
;
125 pragma_handler_2arg handler_2arg
;
127 /* Internally used to keep the data of the handler. */
128 struct internal_pragma_handler_d
{
129 union gen_pragma_handler handler
;
130 /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
131 or a pragma_handler_2arg (extra_data is true). */
133 /* A data field which can be used when extra_data is true. */
136 typedef struct internal_pragma_handler_d internal_pragma_handler
;
138 extern void c_register_pragma (const char *space
, const char *name
,
139 pragma_handler_1arg handler
);
140 extern void c_register_pragma_with_data (const char *space
, const char *name
,
141 pragma_handler_2arg handler
,
144 extern void c_register_pragma_with_expansion (const char *space
,
146 pragma_handler_1arg handler
);
147 extern void c_register_pragma_with_expansion_and_data (const char *space
,
149 pragma_handler_2arg handler
,
151 extern void c_invoke_pragma_handler (unsigned int);
153 extern void maybe_apply_pragma_weak (tree
);
154 extern void maybe_apply_pending_pragma_weaks (void);
155 extern tree
maybe_apply_renaming_pragma (tree
, tree
);
156 extern void add_to_renaming_pragma_list (tree
, tree
);
158 extern enum cpp_ttype
pragma_lex (tree
*);
160 /* Flags for use with c_lex_with_flags. The values here were picked
161 so that 0 means to translate and join strings. */
162 #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
163 execution character set. */
164 #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
165 nor translate them into execution
168 /* This is not actually available to pragma parsers. It's merely a
169 convenient location to declare this function for c-lex, after
170 having enum cpp_ttype declared. */
171 extern enum cpp_ttype
c_lex_with_flags (tree
*, location_t
*, unsigned char *,
174 extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
176 extern GTY(()) tree pragma_extern_prefix
;
178 #endif /* GCC_C_PRAGMA_H */