OSDN Git Service

2009-04-08 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / c-pragma.h
1 /* Pragma related interfaces.
2    Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3    2007, 2008  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_THREADPRIVATE,
47
48   PRAGMA_GCC_PCH_PREPROCESS,
49
50   PRAGMA_FIRST_EXTERNAL
51 } pragma_kind;
52
53
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,
58
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,
64   PRAGMA_OMP_CLAUSE_IF,
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;
75
76 extern struct cpp_reader* parse_in;
77
78 #define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
79
80 #ifdef HANDLE_SYSV_PRAGMA
81 /* We always support #pragma pack for SYSV pragmas.  */
82 #ifndef HANDLE_PRAGMA_PACK
83 #define HANDLE_PRAGMA_PACK 1
84 #endif
85 #endif /* HANDLE_SYSV_PRAGMA */
86
87
88 #ifdef HANDLE_PRAGMA_PACK_PUSH_POP
89 /* If we are supporting #pragma pack(push... then we automatically
90    support #pragma pack(<n>)  */
91 #define HANDLE_PRAGMA_PACK 1
92 #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
93
94 /* It's safe to always leave visibility pragma enabled as if
95    visibility is not supported on the host OS platform the
96    statements are ignored.  */
97 #define HANDLE_PRAGMA_VISIBILITY 1
98 extern void push_visibility (const char *);
99 extern void pop_visibility (void);
100
101 extern void init_pragma (void);
102
103 /* Front-end wrappers for pragma registration.  */
104 typedef void (*pragma_handler)(struct cpp_reader *);
105 extern void c_register_pragma (const char *, const char *, pragma_handler);
106 extern void c_register_pragma_with_expansion (const char *, const char *,
107                                               pragma_handler);
108 extern void c_invoke_pragma_handler (unsigned int);
109
110 extern void maybe_apply_pragma_weak (tree);
111 extern void maybe_apply_pending_pragma_weaks (void);
112 extern tree maybe_apply_renaming_pragma (tree, tree);
113 extern void add_to_renaming_pragma_list (tree, tree);
114
115 extern enum cpp_ttype pragma_lex (tree *);
116
117 /* Flags for use with c_lex_with_flags.  The values here were picked
118    so that 0 means to translate and join strings.  */
119 #define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into
120                                        execution character set.  */
121 #define C_LEX_RAW_STRINGS         2 /* Return raw strings -- no
122                                        concatenation, no
123                                        translation.  */
124
125 /* This is not actually available to pragma parsers.  It's merely a
126    convenient location to declare this function for c-lex, after
127    having enum cpp_ttype declared.  */
128 extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
129                                         int);
130
131 extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
132
133 #endif /* GCC_C_PRAGMA_H */