xref: /dflybsd-src/contrib/gcc-4.7/gcc/c-family/c-pragma.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Pragma related interfaces.
2*e4b17023SJohn Marino    Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3*e4b17023SJohn Marino    2007, 2008, 2009, 2010  Free Software Foundation, Inc.
4*e4b17023SJohn Marino 
5*e4b17023SJohn Marino This file is part of GCC.
6*e4b17023SJohn Marino 
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino #ifndef GCC_C_PRAGMA_H
22*e4b17023SJohn Marino #define GCC_C_PRAGMA_H
23*e4b17023SJohn Marino 
24*e4b17023SJohn Marino #include "cpplib.h" /* For enum cpp_ttype.  */
25*e4b17023SJohn Marino 
26*e4b17023SJohn Marino /* Pragma identifiers built in to the front end parsers.  Identifiers
27*e4b17023SJohn Marino    for ancillary handlers will follow these.  */
28*e4b17023SJohn Marino typedef enum pragma_kind {
29*e4b17023SJohn Marino   PRAGMA_NONE = 0,
30*e4b17023SJohn Marino 
31*e4b17023SJohn Marino   PRAGMA_OMP_ATOMIC,
32*e4b17023SJohn Marino   PRAGMA_OMP_BARRIER,
33*e4b17023SJohn Marino   PRAGMA_OMP_CRITICAL,
34*e4b17023SJohn Marino   PRAGMA_OMP_FLUSH,
35*e4b17023SJohn Marino   PRAGMA_OMP_FOR,
36*e4b17023SJohn Marino   PRAGMA_OMP_MASTER,
37*e4b17023SJohn Marino   PRAGMA_OMP_ORDERED,
38*e4b17023SJohn Marino   PRAGMA_OMP_PARALLEL,
39*e4b17023SJohn Marino   PRAGMA_OMP_PARALLEL_FOR,
40*e4b17023SJohn Marino   PRAGMA_OMP_PARALLEL_SECTIONS,
41*e4b17023SJohn Marino   PRAGMA_OMP_SECTION,
42*e4b17023SJohn Marino   PRAGMA_OMP_SECTIONS,
43*e4b17023SJohn Marino   PRAGMA_OMP_SINGLE,
44*e4b17023SJohn Marino   PRAGMA_OMP_TASK,
45*e4b17023SJohn Marino   PRAGMA_OMP_TASKWAIT,
46*e4b17023SJohn Marino   PRAGMA_OMP_TASKYIELD,
47*e4b17023SJohn Marino   PRAGMA_OMP_THREADPRIVATE,
48*e4b17023SJohn Marino 
49*e4b17023SJohn Marino   PRAGMA_GCC_PCH_PREPROCESS,
50*e4b17023SJohn Marino 
51*e4b17023SJohn Marino   PRAGMA_FIRST_EXTERNAL
52*e4b17023SJohn Marino } pragma_kind;
53*e4b17023SJohn Marino 
54*e4b17023SJohn Marino 
55*e4b17023SJohn Marino /* All clauses defined by OpenMP 2.5 and 3.0.
56*e4b17023SJohn Marino    Used internally by both C and C++ parsers.  */
57*e4b17023SJohn Marino typedef enum pragma_omp_clause {
58*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_NONE = 0,
59*e4b17023SJohn Marino 
60*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_COLLAPSE,
61*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_COPYIN,
62*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_COPYPRIVATE,
63*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_DEFAULT,
64*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
65*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_IF,
66*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_LASTPRIVATE,
67*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_NOWAIT,
68*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_NUM_THREADS,
69*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_ORDERED,
70*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_PRIVATE,
71*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_REDUCTION,
72*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_SCHEDULE,
73*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_SHARED,
74*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_UNTIED,
75*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_FINAL,
76*e4b17023SJohn Marino   PRAGMA_OMP_CLAUSE_MERGEABLE
77*e4b17023SJohn Marino } pragma_omp_clause;
78*e4b17023SJohn Marino 
79*e4b17023SJohn Marino extern struct cpp_reader* parse_in;
80*e4b17023SJohn Marino 
81*e4b17023SJohn Marino /* It's safe to always leave visibility pragma enabled as if
82*e4b17023SJohn Marino    visibility is not supported on the host OS platform the
83*e4b17023SJohn Marino    statements are ignored.  */
84*e4b17023SJohn Marino extern void push_visibility (const char *, int);
85*e4b17023SJohn Marino extern bool pop_visibility (int);
86*e4b17023SJohn Marino 
87*e4b17023SJohn Marino extern void init_pragma (void);
88*e4b17023SJohn Marino 
89*e4b17023SJohn Marino /* Front-end wrappers for pragma registration.  */
90*e4b17023SJohn Marino typedef void (*pragma_handler_1arg)(struct cpp_reader *);
91*e4b17023SJohn Marino /* A second pragma handler, which adds a void * argument allowing to pass extra
92*e4b17023SJohn Marino    data to the handler.  */
93*e4b17023SJohn Marino typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *);
94*e4b17023SJohn Marino 
95*e4b17023SJohn Marino /* This union allows to abstract the different handlers.  */
96*e4b17023SJohn Marino union gen_pragma_handler {
97*e4b17023SJohn Marino   pragma_handler_1arg handler_1arg;
98*e4b17023SJohn Marino   pragma_handler_2arg handler_2arg;
99*e4b17023SJohn Marino };
100*e4b17023SJohn Marino /* Internally used to keep the data of the handler.  */
101*e4b17023SJohn Marino struct internal_pragma_handler_d {
102*e4b17023SJohn Marino   union gen_pragma_handler handler;
103*e4b17023SJohn Marino   /* Permits to know if handler is a pragma_handler_1arg (extra_data is false)
104*e4b17023SJohn Marino      or a pragma_handler_2arg (extra_data is true).  */
105*e4b17023SJohn Marino   bool extra_data;
106*e4b17023SJohn Marino   /* A data field which can be used when extra_data is true.  */
107*e4b17023SJohn Marino   void * data;
108*e4b17023SJohn Marino };
109*e4b17023SJohn Marino typedef struct internal_pragma_handler_d internal_pragma_handler;
110*e4b17023SJohn Marino 
111*e4b17023SJohn Marino extern void c_register_pragma (const char *space, const char *name,
112*e4b17023SJohn Marino                                pragma_handler_1arg handler);
113*e4b17023SJohn Marino extern void c_register_pragma_with_data (const char *space, const char *name,
114*e4b17023SJohn Marino                                          pragma_handler_2arg handler,
115*e4b17023SJohn Marino                                          void *data);
116*e4b17023SJohn Marino 
117*e4b17023SJohn Marino extern void c_register_pragma_with_expansion (const char *space,
118*e4b17023SJohn Marino                                               const char *name,
119*e4b17023SJohn Marino                                               pragma_handler_1arg handler);
120*e4b17023SJohn Marino extern void c_register_pragma_with_expansion_and_data (const char *space,
121*e4b17023SJohn Marino                                                        const char *name,
122*e4b17023SJohn Marino                                                    pragma_handler_2arg handler,
123*e4b17023SJohn Marino                                                        void *data);
124*e4b17023SJohn Marino extern void c_invoke_pragma_handler (unsigned int);
125*e4b17023SJohn Marino 
126*e4b17023SJohn Marino extern void maybe_apply_pragma_weak (tree);
127*e4b17023SJohn Marino extern void maybe_apply_pending_pragma_weaks (void);
128*e4b17023SJohn Marino extern tree maybe_apply_renaming_pragma (tree, tree);
129*e4b17023SJohn Marino extern void add_to_renaming_pragma_list (tree, tree);
130*e4b17023SJohn Marino 
131*e4b17023SJohn Marino extern enum cpp_ttype pragma_lex (tree *);
132*e4b17023SJohn Marino 
133*e4b17023SJohn Marino /* Flags for use with c_lex_with_flags.  The values here were picked
134*e4b17023SJohn Marino    so that 0 means to translate and join strings.  */
135*e4b17023SJohn Marino #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
136*e4b17023SJohn Marino 				       execution character set.  */
137*e4b17023SJohn Marino #define C_LEX_STRING_NO_JOIN	  2 /* Do not concatenate strings
138*e4b17023SJohn Marino 				       nor translate them into execution
139*e4b17023SJohn Marino 				       character set.  */
140*e4b17023SJohn Marino 
141*e4b17023SJohn Marino /* This is not actually available to pragma parsers.  It's merely a
142*e4b17023SJohn Marino    convenient location to declare this function for c-lex, after
143*e4b17023SJohn Marino    having enum cpp_ttype declared.  */
144*e4b17023SJohn Marino extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
145*e4b17023SJohn Marino 					int);
146*e4b17023SJohn Marino 
147*e4b17023SJohn Marino extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
148*e4b17023SJohn Marino 
149*e4b17023SJohn Marino extern GTY(()) tree pragma_extern_prefix;
150*e4b17023SJohn Marino 
151*e4b17023SJohn Marino #endif /* GCC_C_PRAGMA_H */
152