1 /* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-O2 -fselective-scheduling2 -fsel-sched-pipelining -Wno-return-type" } */
5 typedef struct _IO_FILE FILE;
6 extern int putc(int __c, FILE * __stream);
7 extern int strcmp(__const char *__s1, __const char *__s2) throw()
8 __attribute__ ((__pure__)) __attribute__ ((__nonnull__(1, 2)));
9 } typedef union tree_node *tree;
13 extern struct gcc_options global_options;
14 struct ht_identifier {
15 const unsigned char *str;
18 CPP_SEMICOLON, CPP_NAME
25 typedef vl_embed default_layout;
27 template < typename T, typename A = va_heap, typename L =
28 typename A::default_layout > struct vec {
36 struct tree_identifier {
41 struct tree_identifier
45 tree_check(tree __t, const char *__f, int __l, const char *__g, tree_code __c)
49 extern tree chainon(tree, tree);
50 extern vec < tree, va_gc > *make_tree_vector(void);
51 typedef unsigned long omp_clause_mask;
52 enum c_omp_clause_split {
53 C_OMP_CLAUSE_SPLIT_TARGET = 0, C_OMP_CLAUSE_SPLIT_COUNT
55 typedef struct cxx_saved_binding {
57 } cp_decl_specifier_seq;
58 typedef enum pragma_kind {
59 PRAGMA_NONE = 0, PRAGMA_OMP_DECLARE_REDUCTION, PRAGMA_OMP_TARGET
61 typedef enum pragma_omp_clause {
62 PRAGMA_OMP_CLAUSE_NONE =
63 0, PRAGMA_OMP_CLAUSE_DEVICE, PRAGMA_OMP_CLAUSE_IF,
66 typedef struct cp_token {
67 enum cpp_ttype type:8;
68 union cp_token_value {
72 typedef struct cp_token *cp_token_position;
73 typedef struct cp_lexer {
74 cp_token_position next_token;
78 static FILE *cp_lexer_debug_stream;
79 static inline bool cp_lexer_debugging_p(cp_lexer * lexer)
81 return lexer->debugging_p;
84 static inline cp_token *cp_lexer_peek_token(cp_lexer * lexer)
86 if (cp_lexer_debugging_p(lexer)) {
87 putc('\n', cp_lexer_debug_stream);
89 return lexer->next_token;
92 static inline bool cp_lexer_next_token_is(cp_lexer * lexer, enum cpp_ttype type)
97 CP_PARSER_FLAGS_NONE = 0x0, CP_PARSER_FLAGS_OPTIONAL =
98 0x1, CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES =
99 0x2, CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS =
100 0x4, CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR = 0x8
102 typedef int cp_parser_flags;
104 cp_parser_type_specifier(cp_parser *, cp_parser_flags,
105 cp_decl_specifier_seq *, bool, int *, bool *);
107 cp_parser_type_specifier_seq(cp_parser *, bool, bool, cp_decl_specifier_seq *);
108 extern bool cp_next_tokens_can_be_attribute_p(cp_parser *);
109 extern tree cp_parser_attributes_opt(cp_parser *);
110 enum pragma_context {
117 static bool cp_parser_pragma(cp_parser *, enum pragma_context);
118 static bool cp_parser_translation_unit(cp_parser * parser)
122 if (token->type == CPP_SEMICOLON) {
123 cp_parser_pragma(parser, pragma_external);
129 cp_parser_type_id_1(cp_parser * parser, bool is_template_arg,
130 bool is_trailing_return)
132 cp_decl_specifier_seq type_specifier_seq;
133 cp_parser_type_specifier_seq(parser, false, is_trailing_return,
134 &type_specifier_seq);
137 static tree cp_parser_type_id(cp_parser * parser)
139 return cp_parser_type_id_1(parser, false, false);
143 cp_parser_type_specifier_seq(cp_parser * parser, bool is_declaration,
144 bool is_trailing_return,
145 cp_decl_specifier_seq * type_specifier_seq)
147 cp_parser_flags flags = CP_PARSER_FLAGS_OPTIONAL;
148 cp_token *start_token = __null;
151 bool is_cv_qualifier;
152 if (cp_next_tokens_can_be_attribute_p(parser)) {
153 type_specifier_seq->attributes =
154 chainon(type_specifier_seq->attributes,
155 cp_parser_attributes_opt(parser));
159 start_token = cp_lexer_peek_token(parser->lexer);
161 cp_parser_type_specifier(parser, flags, type_specifier_seq,
162 false, __null, &is_cv_qualifier);
163 if (!type_specifier) {
166 if (is_declaration && !is_cv_qualifier)
167 flags |= CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES;
172 cp_parser_omp_for_loop_init(cp_parser * parser, bool parsing_openmp,
173 tree & this_pre_body, vec < tree,
174 va_gc > *for_block, tree & init, tree & decl,
177 cp_decl_specifier_seq type_specifiers;
178 cp_parser_type_specifier_seq(parser, true, false, &type_specifiers);
182 cp_parser_omp_for_loop(cp_parser * parser, enum tree_code code, tree clauses,
185 tree init, cond, incr, body, decl, pre_body = (tree) __null, ret;
186 tree real_decl, initv, condv, incrv, declv;
187 tree this_pre_body, cl;
188 int i, collapse = 1, nbraces = 0;
189 vec < tree, va_gc > *for_block = make_tree_vector();
190 for (i = 0; i < collapse; i++) {
191 bool add_private_clause = false;
192 add_private_clause |=
193 cp_parser_omp_for_loop_init(parser, true,
194 this_pre_body, for_block, init,
200 cp_parser_omp_simd(cp_parser * parser, cp_token * pragma_tok, char *p_name,
201 omp_clause_mask mask, tree * cclauses)
203 tree clauses, sb, ret;
204 ret = cp_parser_omp_for_loop(parser, OMP_SIMD, clauses, cclauses);
208 cp_parser_omp_distribute(cp_parser * parser, cp_token * pragma_tok,
209 char *p_name, omp_clause_mask mask, tree * cclauses)
211 if (cp_lexer_next_token_is(parser->lexer, CPP_NAME)) {
212 tree id = cp_lexer_peek_token(parser->lexer)->u.value;
216 "/home/bonzo/develop/trunk/gcc/cp/parser.c",
218 (IDENTIFIER_NODE)))->identifier.id.str);
220 bool parallel = false;
221 if (strcmp(p, "simd") == 0)
223 if (parallel || simd) {
224 if (!global_options.x_flag_openmp) {
226 return cp_parser_omp_simd(parser,
236 cp_parser_omp_teams(cp_parser * parser, cp_token * pragma_tok, char *p_name,
237 omp_clause_mask mask, tree * cclauses)
239 if (cp_lexer_next_token_is(parser->lexer, CPP_NAME)) {
240 tree id = cp_lexer_peek_token(parser->lexer)->u.value;
244 "/home/bonzo/develop/trunk/gcc/cp/parser.c",
246 (IDENTIFIER_NODE)))->identifier.id.str);
247 if (strcmp(p, "distribute") == 0) {
248 if (!global_options.x_flag_openmp)
249 return cp_parser_omp_distribute(parser,
258 cp_parser_omp_target(cp_parser * parser, cp_token * pragma_tok,
259 enum pragma_context context)
261 if (context != pragma_stmt && context != pragma_compound) {
262 tree id = cp_lexer_peek_token(parser->lexer)->u.value;
266 "/home/bonzo/develop/trunk/gcc/cp/parser.c",
268 (IDENTIFIER_NODE)))->identifier.id.str);
269 if (strcmp(p, "teams") == 0) {
270 tree cclauses[C_OMP_CLAUSE_SPLIT_COUNT];
272 ("#pragma omp target teams distribute "
273 "parallel for simd")];
274 if (!global_options.x_flag_openmp)
275 return cp_parser_omp_teams(parser, pragma_tok,
279 PRAGMA_OMP_CLAUSE_DEVICE)
283 PRAGMA_OMP_CLAUSE_MAP)
287 PRAGMA_OMP_CLAUSE_IF)),
294 cp_parser_omp_declare_reduction(cp_parser * parser, cp_token * pragma_tok,
297 tree reduc_id = (tree) __null, orig_reduc_id = (tree) __null, type;
299 type = cp_parser_type_id(parser);
304 cp_parser_omp_declare(cp_parser * parser, cp_token * pragma_tok,
305 enum pragma_context context)
307 if (cp_lexer_next_token_is(parser->lexer, CPP_NAME)) {
308 tree id = cp_lexer_peek_token(parser->lexer)->u.value;
312 "/home/bonzo/develop/trunk/gcc/cp/parser.c",
314 (IDENTIFIER_NODE)))->identifier.id.str);
315 if (strcmp(p, "simd") == 0) {
316 cp_parser_omp_declare_reduction(parser, pragma_tok,
322 static cp_parser *the_parser;
323 static bool cp_parser_pragma(cp_parser * parser, enum pragma_context context)
325 cp_token *pragma_tok;
328 case PRAGMA_OMP_DECLARE_REDUCTION:
329 cp_parser_omp_declare(parser, pragma_tok, context);
330 case PRAGMA_OMP_TARGET:
331 return cp_parser_omp_target(parser, pragma_tok, context);
335 void c_parse_file(void)
337 cp_parser_translation_unit(the_parser);