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
{
38 PRAGMA_OMP_PARALLEL_FOR
,
39 PRAGMA_OMP_PARALLEL_SECTIONS
,
46 PRAGMA_OMP_THREADPRIVATE
,
48 PRAGMA_GCC_PCH_PREPROCESS
,
54 /* All clauses defined by OpenMP 2.5 and 3.0.
55 Used internally by both C and C++ parsers. */
56 typedef enum pragma_omp_clause
{
57 PRAGMA_OMP_CLAUSE_NONE
= 0,
59 PRAGMA_OMP_CLAUSE_COLLAPSE
,
60 PRAGMA_OMP_CLAUSE_COPYIN
,
61 PRAGMA_OMP_CLAUSE_COPYPRIVATE
,
62 PRAGMA_OMP_CLAUSE_DEFAULT
,
63 PRAGMA_OMP_CLAUSE_FIRSTPRIVATE
,
65 PRAGMA_OMP_CLAUSE_LASTPRIVATE
,
66 PRAGMA_OMP_CLAUSE_NOWAIT
,
67 PRAGMA_OMP_CLAUSE_NUM_THREADS
,
68 PRAGMA_OMP_CLAUSE_ORDERED
,
69 PRAGMA_OMP_CLAUSE_PRIVATE
,
70 PRAGMA_OMP_CLAUSE_REDUCTION
,
71 PRAGMA_OMP_CLAUSE_SCHEDULE
,
72 PRAGMA_OMP_CLAUSE_SHARED
,
73 PRAGMA_OMP_CLAUSE_UNTIED
,
74 PRAGMA_OMP_CLAUSE_FINAL
,
75 PRAGMA_OMP_CLAUSE_MERGEABLE
78 extern struct cpp_reader
* parse_in
;
80 /* It's safe to always leave visibility pragma enabled as if
81 visibility is not supported on the host OS platform the
82 statements are ignored. */
83 extern void push_visibility (const char *, int);
84 extern bool pop_visibility (int);
86 extern void init_pragma (void);
88 /* Front-end wrappers for pragma registration. */
89 typedef void (*pragma_handler_1arg
)(struct cpp_reader
*);
90 /* A second pragma handler, which adds a void * argument allowing to pass extra
91 data to the handler. */
92 typedef void (*pragma_handler_2arg
)(struct cpp_reader
*, void *);
94 /* This union allows to abstract the different handlers. */
95 union gen_pragma_handler
{
96 pragma_handler_1arg handler_1arg
;
97 pragma_handler_2arg handler_2arg
;
99 /* Internally used to keep the data of the handler. */
100 struct internal_pragma_handler_d
{
101 union gen_pragma_handler handler
;
102 /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
103 or a pragma_handler_2arg (extra_data is true). */
105 /* A data field which can be used when extra_data is true. */
108 typedef struct internal_pragma_handler_d internal_pragma_handler
;
110 extern void c_register_pragma (const char *space
, const char *name
,
111 pragma_handler_1arg handler
);
112 extern void c_register_pragma_with_data (const char *space
, const char *name
,
113 pragma_handler_2arg handler
,
116 extern void c_register_pragma_with_expansion (const char *space
,
118 pragma_handler_1arg handler
);
119 extern void c_register_pragma_with_expansion_and_data (const char *space
,
121 pragma_handler_2arg handler
,
123 extern void c_invoke_pragma_handler (unsigned int);
125 extern void maybe_apply_pragma_weak (tree
);
126 extern void maybe_apply_pending_pragma_weaks (void);
127 extern tree
maybe_apply_renaming_pragma (tree
, tree
);
128 extern void add_to_renaming_pragma_list (tree
, tree
);
130 extern enum cpp_ttype
pragma_lex (tree
*);
132 /* Flags for use with c_lex_with_flags. The values here were picked
133 so that 0 means to translate and join strings. */
134 #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
135 execution character set. */
136 #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings
137 nor translate them into execution
140 /* This is not actually available to pragma parsers. It's merely a
141 convenient location to declare this function for c-lex, after
142 having enum cpp_ttype declared. */
143 extern enum cpp_ttype
c_lex_with_flags (tree
*, location_t
*, unsigned char *,
146 extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
148 extern GTY(()) tree pragma_extern_prefix
;
150 #endif /* GCC_C_PRAGMA_H */