OSDN Git Service

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