diff options
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 244 |
1 files changed, 136 insertions, 108 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index d37c691..1b6bacd 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -1342,12 +1342,12 @@ static vec<tree, va_gc> *c_parser_expr_list (c_parser *, bool, bool, static void c_parser_oacc_declare (c_parser *); static void c_parser_oacc_enter_exit_data (c_parser *, bool); static void c_parser_oacc_update (c_parser *); -static void c_parser_omp_construct (c_parser *); +static void c_parser_omp_construct (c_parser *, bool *); static void c_parser_omp_threadprivate (c_parser *); static void c_parser_omp_barrier (c_parser *); static void c_parser_omp_flush (c_parser *); static tree c_parser_omp_for_loop (location_t, c_parser *, enum tree_code, - tree, tree *); + tree, tree *, bool *); static void c_parser_omp_taskwait (c_parser *); static void c_parser_omp_taskyield (c_parser *); static void c_parser_omp_cancel (c_parser *); @@ -1355,11 +1355,11 @@ static void c_parser_omp_cancellation_point (c_parser *); enum pragma_context { pragma_external, pragma_struct, pragma_param, pragma_stmt, pragma_compound }; -static bool c_parser_pragma (c_parser *, enum pragma_context); -static bool c_parser_omp_target (c_parser *, enum pragma_context); +static bool c_parser_pragma (c_parser *, enum pragma_context, bool *); +static bool c_parser_omp_target (c_parser *, enum pragma_context, bool *); static void c_parser_omp_end_declare_target (c_parser *); static void c_parser_omp_declare (c_parser *, enum pragma_context); -static bool c_parser_omp_ordered (c_parser *, enum pragma_context); +static bool c_parser_omp_ordered (c_parser *, enum pragma_context, bool *); static void c_parser_oacc_routine (c_parser *parser, enum pragma_context); /* These Objective-C parser functions are only ever called when @@ -1390,12 +1390,12 @@ static bool c_parser_objc_diagnose_bad_element_prefix (c_parser *, struct c_declspecs *); /* Cilk Plus supporting routines. */ -static void c_parser_cilk_simd (c_parser *); -static void c_parser_cilk_for (c_parser *, tree); +static void c_parser_cilk_simd (c_parser *, bool *); +static void c_parser_cilk_for (c_parser *, tree, bool *); static bool c_parser_cilk_verify_simd (c_parser *, enum pragma_context); static tree c_parser_array_notation (location_t, c_parser *, tree, tree); static tree c_parser_cilk_clause_vectorlength (c_parser *, tree, bool); -static void c_parser_cilk_grainsize (c_parser *); +static void c_parser_cilk_grainsize (c_parser *, bool *); /* Parse a translation unit (C90 6.7, C99 6.9). @@ -1527,7 +1527,7 @@ c_parser_external_declaration (c_parser *parser) break; case CPP_PRAGMA: mark_valid_location_for_stdc_pragma (true); - c_parser_pragma (parser, pragma_external); + c_parser_pragma (parser, pragma_external, NULL); mark_valid_location_for_stdc_pragma (false); break; case CPP_PLUS: @@ -2927,7 +2927,7 @@ c_parser_struct_or_union_specifier (c_parser *parser) /* Accept #pragmas at struct scope. */ if (c_parser_next_token_is (parser, CPP_PRAGMA)) { - c_parser_pragma (parser, pragma_struct); + c_parser_pragma (parser, pragma_struct, NULL); continue; } /* Parse some comma-separated declarations, but not the @@ -3796,7 +3796,7 @@ c_parser_parameter_declaration (c_parser *parser, tree attrs) /* Accept #pragmas between parameter declarations. */ while (c_parser_next_token_is (parser, CPP_PRAGMA)) - c_parser_pragma (parser, pragma_param); + c_parser_pragma (parser, pragma_param, NULL); if (!c_parser_next_token_starts_declspecs (parser)) { @@ -4824,7 +4824,8 @@ c_parser_compound_statement_nostart (c_parser *parser) places that would turn into syntax errors if the directive were ignored. */ if (c_parser_pragma (parser, - last_label ? pragma_stmt : pragma_compound)) + last_label ? pragma_stmt : pragma_compound, + NULL)) last_label = false, last_stmt = true; } else if (c_parser_next_token_is (parser, CPP_EOF)) @@ -5156,7 +5157,7 @@ c_parser_statement_after_labels (c_parser *parser, bool *if_p, c_parser_skip_to_end_of_block_or_statement (parser); } else - c_parser_cilk_for (parser, integer_zero_node); + c_parser_cilk_for (parser, integer_zero_node, if_p); break; case RID_CILK_SYNC: c_parser_consume_token (parser); @@ -5276,7 +5277,7 @@ c_parser_statement_after_labels (c_parser *parser, bool *if_p, c_parser_consume_token (parser); break; case CPP_PRAGMA: - c_parser_pragma (parser, pragma_stmt); + c_parser_pragma (parser, pragma_stmt, if_p); break; default: expr_stmt: @@ -8787,7 +8788,7 @@ c_parser_objc_class_instance_variables (c_parser *parser) } else if (c_parser_next_token_is (parser, CPP_PRAGMA)) { - c_parser_pragma (parser, pragma_external); + c_parser_pragma (parser, pragma_external, NULL); continue; } @@ -9058,7 +9059,7 @@ c_parser_objc_methodprotolist (c_parser *parser) c_parser_objc_methodproto (parser); break; case CPP_PRAGMA: - c_parser_pragma (parser, pragma_external); + c_parser_pragma (parser, pragma_external, NULL); break; case CPP_EOF: return; @@ -10019,7 +10020,7 @@ c_parser_objc_at_dynamic_declaration (c_parser *parser) true if we actually parsed such a pragma. */ static bool -c_parser_pragma (c_parser *parser, enum pragma_context context) +c_parser_pragma (c_parser *parser, enum pragma_context context, bool *if_p) { unsigned int id; @@ -10126,7 +10127,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) return false; case PRAGMA_OMP_TARGET: - return c_parser_omp_target (parser, context); + return c_parser_omp_target (parser, context, if_p); case PRAGMA_OMP_END_DECLARE_TARGET: c_parser_omp_end_declare_target (parser); @@ -10144,7 +10145,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) return false; case PRAGMA_OMP_ORDERED: - return c_parser_omp_ordered (parser, context); + return c_parser_omp_ordered (parser, context, if_p); case PRAGMA_IVDEP: c_parser_consume_pragma (parser); @@ -10157,9 +10158,9 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) return false; } if (c_parser_next_token_is_keyword (parser, RID_FOR)) - c_parser_for_statement (parser, true, NULL); + c_parser_for_statement (parser, true, if_p); else if (c_parser_next_token_is_keyword (parser, RID_WHILE)) - c_parser_while_statement (parser, true, NULL); + c_parser_while_statement (parser, true, if_p); else c_parser_do_statement (parser, true); return false; @@ -10173,7 +10174,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) if (!c_parser_cilk_verify_simd (parser, context)) return false; c_parser_consume_pragma (parser); - c_parser_cilk_simd (parser); + c_parser_cilk_simd (parser, if_p); return false; case PRAGMA_CILK_GRAINSIZE: if (!flag_cilkplus) @@ -10190,7 +10191,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL); return false; } - c_parser_cilk_grainsize (parser); + c_parser_cilk_grainsize (parser, if_p); return false; default: @@ -10203,7 +10204,7 @@ c_parser_pragma (c_parser *parser, enum pragma_context context) c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NULL); return false; } - c_parser_omp_construct (parser); + c_parser_omp_construct (parser, if_p); return true; } break; @@ -13477,10 +13478,10 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask, c_parser_statement calls add_stmt. */ static tree -c_parser_omp_structured_block (c_parser *parser) +c_parser_omp_structured_block (c_parser *parser, bool *if_p) { tree stmt = push_stmt_list (); - c_parser_statement (parser, NULL); + c_parser_statement (parser, if_p); return pop_stmt_list (stmt); } @@ -13530,7 +13531,7 @@ c_parser_oacc_cache (location_t loc, c_parser *parser) | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE) ) static tree -c_parser_oacc_data (location_t loc, c_parser *parser) +c_parser_oacc_data (location_t loc, c_parser *parser, bool *if_p) { tree stmt, clauses, block; @@ -13538,7 +13539,7 @@ c_parser_oacc_data (location_t loc, c_parser *parser) "#pragma acc data"); block = c_begin_omp_parallel (); - add_stmt (c_parser_omp_structured_block (parser)); + add_stmt (c_parser_omp_structured_block (parser, if_p)); stmt = c_finish_oacc_data (loc, clauses, block); @@ -13784,7 +13785,7 @@ c_parser_oacc_enter_exit_data (c_parser *parser, bool enter) ( (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_USE_DEVICE) ) static tree -c_parser_oacc_host_data (location_t loc, c_parser *parser) +c_parser_oacc_host_data (location_t loc, c_parser *parser, bool *if_p) { tree stmt, clauses, block; @@ -13792,7 +13793,7 @@ c_parser_oacc_host_data (location_t loc, c_parser *parser) "#pragma acc host_data"); block = c_begin_omp_parallel (); - add_stmt (c_parser_omp_structured_block (parser)); + add_stmt (c_parser_omp_structured_block (parser, if_p)); stmt = c_finish_oacc_host_data (loc, clauses, block); return stmt; } @@ -13819,7 +13820,7 @@ c_parser_oacc_host_data (location_t loc, c_parser *parser) | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_TILE) ) static tree c_parser_oacc_loop (location_t loc, c_parser *parser, char *p_name, - omp_clause_mask mask, tree *cclauses) + omp_clause_mask mask, tree *cclauses, bool *if_p) { strcat (p_name, " loop"); mask |= OACC_LOOP_CLAUSE_MASK; @@ -13836,7 +13837,8 @@ c_parser_oacc_loop (location_t loc, c_parser *parser, char *p_name, } tree block = c_begin_compound_stmt (true); - tree stmt = c_parser_omp_for_loop (loc, parser, OACC_LOOP, clauses, NULL); + tree stmt = c_parser_omp_for_loop (loc, parser, OACC_LOOP, clauses, NULL, + if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); @@ -13895,7 +13897,8 @@ c_parser_oacc_loop (location_t loc, c_parser *parser, char *p_name, static tree c_parser_oacc_kernels_parallel (location_t loc, c_parser *parser, - enum pragma_kind p_kind, char *p_name) + enum pragma_kind p_kind, char *p_name, + bool *if_p) { omp_clause_mask mask; enum tree_code code; @@ -13925,7 +13928,7 @@ c_parser_oacc_kernels_parallel (location_t loc, c_parser *parser, tree block = c_begin_omp_parallel (); tree clauses; - c_parser_oacc_loop (loc, parser, p_name, mask, &clauses); + c_parser_oacc_loop (loc, parser, p_name, mask, &clauses, if_p); return c_finish_omp_construct (loc, code, block, clauses); } } @@ -13933,7 +13936,7 @@ c_parser_oacc_kernels_parallel (location_t loc, c_parser *parser, tree clauses = c_parser_oacc_all_clauses (parser, mask, p_name); tree block = c_begin_omp_parallel (); - add_stmt (c_parser_omp_structured_block (parser)); + add_stmt (c_parser_omp_structured_block (parser, if_p)); return c_finish_omp_construct (loc, code, block, clauses); } @@ -14576,7 +14579,7 @@ c_parser_omp_barrier (c_parser *parser) ( (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_HINT) ) static tree -c_parser_omp_critical (location_t loc, c_parser *parser) +c_parser_omp_critical (location_t loc, c_parser *parser, bool *if_p) { tree stmt, name = NULL_TREE, clauses = NULL_TREE; @@ -14603,7 +14606,7 @@ c_parser_omp_critical (location_t loc, c_parser *parser) c_parser_skip_to_pragma_eol (parser); } - stmt = c_parser_omp_structured_block (parser); + stmt = c_parser_omp_structured_block (parser, if_p); return c_finish_omp_critical (loc, stmt, name, clauses); } @@ -14635,7 +14638,7 @@ c_parser_omp_flush (c_parser *parser) static tree c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, - tree clauses, tree *cclauses) + tree clauses, tree *cclauses, bool *if_p) { tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl; tree declv, condv, incrv, initv, ret = NULL_TREE; @@ -14865,6 +14868,9 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, nbraces += bracecount; } + if (nbraces) + if_p = NULL; + save_break = c_break_label; if (code == CILK_SIMD) c_break_label = build_int_cst (size_type_node, 2); @@ -14882,7 +14888,7 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, add_stmt (c_end_compound_stmt (here, stmt, true)); } else - add_stmt (c_parser_c99_block_statement (parser, NULL)); + add_stmt (c_parser_c99_block_statement (parser, if_p)); if (c_cont_label) { tree t = build1 (LABEL_EXPR, void_type_node, c_cont_label); @@ -15025,7 +15031,8 @@ omp_split_clauses (location_t loc, enum tree_code code, static tree c_parser_omp_simd (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree block, clauses, ret; @@ -15049,7 +15056,7 @@ c_parser_omp_simd (location_t loc, c_parser *parser, } block = c_begin_compound_stmt (true); - ret = c_parser_omp_for_loop (loc, parser, OMP_SIMD, clauses, cclauses); + ret = c_parser_omp_for_loop (loc, parser, OMP_SIMD, clauses, cclauses, if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); @@ -15080,7 +15087,8 @@ c_parser_omp_simd (location_t loc, c_parser *parser, static tree c_parser_omp_for (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree block, clauses, ret; @@ -15104,9 +15112,10 @@ c_parser_omp_for (location_t loc, c_parser *parser, c_parser_consume_token (parser); if (!flag_openmp) /* flag_openmp_simd */ - return c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + return c_parser_omp_simd (loc, parser, p_name, mask, cclauses, + if_p); block = c_begin_compound_stmt (true); - ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses, if_p); block = c_end_compound_stmt (loc, block, true); if (ret == NULL_TREE) return ret; @@ -15137,7 +15146,7 @@ c_parser_omp_for (location_t loc, c_parser *parser, } block = c_begin_compound_stmt (true); - ret = c_parser_omp_for_loop (loc, parser, OMP_FOR, clauses, cclauses); + ret = c_parser_omp_for_loop (loc, parser, OMP_FOR, clauses, cclauses, if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); @@ -15152,10 +15161,11 @@ c_parser_omp_for (location_t loc, c_parser *parser, */ static tree -c_parser_omp_master (location_t loc, c_parser *parser) +c_parser_omp_master (location_t loc, c_parser *parser, bool *if_p) { c_parser_skip_to_pragma_eol (parser); - return c_finish_omp_master (loc, c_parser_omp_structured_block (parser)); + return c_finish_omp_master (loc, c_parser_omp_structured_block (parser, + if_p)); } /* OpenMP 2.5: @@ -15176,7 +15186,8 @@ c_parser_omp_master (location_t loc, c_parser *parser) (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_DEPEND) static bool -c_parser_omp_ordered (c_parser *parser, enum pragma_context context) +c_parser_omp_ordered (c_parser *parser, enum pragma_context context, + bool *if_p) { location_t loc = c_parser_peek_token (parser)->location; c_parser_consume_pragma (parser); @@ -15215,7 +15226,7 @@ c_parser_omp_ordered (c_parser *parser, enum pragma_context context) tree clauses = c_parser_omp_all_clauses (parser, OMP_ORDERED_CLAUSE_MASK, "#pragma omp ordered"); c_finish_omp_ordered (loc, clauses, - c_parser_omp_structured_block (parser)); + c_parser_omp_structured_block (parser, if_p)); return true; } @@ -15249,7 +15260,7 @@ c_parser_omp_sections_scope (location_t sections_loc, c_parser *parser) if (c_parser_peek_token (parser)->pragma_kind != PRAGMA_OMP_SECTION) { - substmt = c_parser_omp_structured_block (parser); + substmt = c_parser_omp_structured_block (parser, NULL); substmt = build1 (OMP_SECTION, void_type_node, substmt); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -15275,7 +15286,7 @@ c_parser_omp_sections_scope (location_t sections_loc, c_parser *parser) error_suppress = true; } - substmt = c_parser_omp_structured_block (parser); + substmt = c_parser_omp_structured_block (parser, NULL); substmt = build1 (OMP_SECTION, void_type_node, substmt); SET_EXPR_LOCATION (substmt, loc); add_stmt (substmt); @@ -15363,7 +15374,8 @@ c_parser_omp_sections (location_t loc, c_parser *parser, static tree c_parser_omp_parallel (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree stmt, clauses, block; @@ -15382,9 +15394,9 @@ c_parser_omp_parallel (location_t loc, c_parser *parser, c_parser_consume_token (parser); if (!flag_openmp) /* flag_openmp_simd */ - return c_parser_omp_for (loc, parser, p_name, mask, cclauses); + return c_parser_omp_for (loc, parser, p_name, mask, cclauses, if_p); block = c_begin_omp_parallel (); - tree ret = c_parser_omp_for (loc, parser, p_name, mask, cclauses); + tree ret = c_parser_omp_for (loc, parser, p_name, mask, cclauses, if_p); stmt = c_finish_omp_parallel (loc, cclauses[C_OMP_CLAUSE_SPLIT_PARALLEL], block); @@ -15436,7 +15448,7 @@ c_parser_omp_parallel (location_t loc, c_parser *parser, } block = c_begin_omp_parallel (); - c_parser_statement (parser, NULL); + c_parser_statement (parser, if_p); stmt = c_finish_omp_parallel (loc, clauses, block); return stmt; @@ -15456,7 +15468,7 @@ c_parser_omp_parallel (location_t loc, c_parser *parser, | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NOWAIT)) static tree -c_parser_omp_single (location_t loc, c_parser *parser) +c_parser_omp_single (location_t loc, c_parser *parser, bool *if_p) { tree stmt = make_node (OMP_SINGLE); SET_EXPR_LOCATION (stmt, loc); @@ -15465,7 +15477,7 @@ c_parser_omp_single (location_t loc, c_parser *parser) OMP_SINGLE_CLAUSES (stmt) = c_parser_omp_all_clauses (parser, OMP_SINGLE_CLAUSE_MASK, "#pragma omp single"); - OMP_SINGLE_BODY (stmt) = c_parser_omp_structured_block (parser); + OMP_SINGLE_BODY (stmt) = c_parser_omp_structured_block (parser, if_p); return add_stmt (stmt); } @@ -15489,7 +15501,7 @@ c_parser_omp_single (location_t loc, c_parser *parser) | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_PRIORITY)) static tree -c_parser_omp_task (location_t loc, c_parser *parser) +c_parser_omp_task (location_t loc, c_parser *parser, bool *if_p) { tree clauses, block; @@ -15497,7 +15509,7 @@ c_parser_omp_task (location_t loc, c_parser *parser) "#pragma omp task"); block = c_begin_omp_task (); - c_parser_statement (parser, NULL); + c_parser_statement (parser, if_p); return c_finish_omp_task (loc, clauses, block); } @@ -15534,11 +15546,12 @@ c_parser_omp_taskyield (c_parser *parser) */ static tree -c_parser_omp_taskgroup (c_parser *parser) +c_parser_omp_taskgroup (c_parser *parser, bool *if_p) { location_t loc = c_parser_peek_token (parser)->location; c_parser_skip_to_pragma_eol (parser); - return c_finish_omp_taskgroup (loc, c_parser_omp_structured_block (parser)); + return c_finish_omp_taskgroup (loc, c_parser_omp_structured_block (parser, + if_p)); } /* OpenMP 4.0: @@ -15622,7 +15635,8 @@ c_parser_omp_cancellation_point (c_parser *parser) static tree c_parser_omp_distribute (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree clauses, block, ret; @@ -15648,16 +15662,19 @@ c_parser_omp_distribute (location_t loc, c_parser *parser, if (!flag_openmp) /* flag_openmp_simd */ { if (simd) - return c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + return c_parser_omp_simd (loc, parser, p_name, mask, cclauses, + if_p); else return c_parser_omp_parallel (loc, parser, p_name, mask, - cclauses); + cclauses, if_p); } block = c_begin_compound_stmt (true); if (simd) - ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses, + if_p); else - ret = c_parser_omp_parallel (loc, parser, p_name, mask, cclauses); + ret = c_parser_omp_parallel (loc, parser, p_name, mask, cclauses, + if_p); block = c_end_compound_stmt (loc, block, true); if (ret == NULL) return ret; @@ -15684,7 +15701,8 @@ c_parser_omp_distribute (location_t loc, c_parser *parser, } block = c_begin_compound_stmt (true); - ret = c_parser_omp_for_loop (loc, parser, OMP_DISTRIBUTE, clauses, NULL); + ret = c_parser_omp_for_loop (loc, parser, OMP_DISTRIBUTE, clauses, NULL, + if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); @@ -15706,7 +15724,8 @@ c_parser_omp_distribute (location_t loc, c_parser *parser, static tree c_parser_omp_teams (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree clauses, block, ret; @@ -15724,9 +15743,11 @@ c_parser_omp_teams (location_t loc, c_parser *parser, c_parser_consume_token (parser); if (!flag_openmp) /* flag_openmp_simd */ - return c_parser_omp_distribute (loc, parser, p_name, mask, cclauses); + return c_parser_omp_distribute (loc, parser, p_name, mask, + cclauses, if_p); block = c_begin_compound_stmt (true); - ret = c_parser_omp_distribute (loc, parser, p_name, mask, cclauses); + ret = c_parser_omp_distribute (loc, parser, p_name, mask, cclauses, + if_p); block = c_end_compound_stmt (loc, block, true); if (ret == NULL) return ret; @@ -15755,7 +15776,7 @@ c_parser_omp_teams (location_t loc, c_parser *parser, tree stmt = make_node (OMP_TEAMS); TREE_TYPE (stmt) = void_type_node; OMP_TEAMS_CLAUSES (stmt) = clauses; - OMP_TEAMS_BODY (stmt) = c_parser_omp_structured_block (parser); + OMP_TEAMS_BODY (stmt) = c_parser_omp_structured_block (parser, if_p); return add_stmt (stmt); } @@ -15771,7 +15792,7 @@ c_parser_omp_teams (location_t loc, c_parser *parser, | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR)) static tree -c_parser_omp_target_data (location_t loc, c_parser *parser) +c_parser_omp_target_data (location_t loc, c_parser *parser, bool *if_p) { tree clauses = c_parser_omp_all_clauses (parser, OMP_TARGET_DATA_CLAUSE_MASK, @@ -15820,7 +15841,7 @@ c_parser_omp_target_data (location_t loc, c_parser *parser) OMP_TARGET_DATA_CLAUSES (stmt) = clauses; keep_next_level (); tree block = c_begin_compound_stmt (true); - add_stmt (c_parser_omp_structured_block (parser)); + add_stmt (c_parser_omp_structured_block (parser, if_p)); OMP_TARGET_DATA_BODY (stmt) = c_end_compound_stmt (loc, block, true); SET_EXPR_LOCATION (stmt, loc); @@ -16060,7 +16081,7 @@ c_parser_omp_target_exit_data (location_t loc, c_parser *parser, | (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR)) static bool -c_parser_omp_target (c_parser *parser, enum pragma_context context) +c_parser_omp_target (c_parser *parser, enum pragma_context context, bool *if_p) { location_t loc = c_parser_peek_token (parser)->location; c_parser_consume_pragma (parser); @@ -16100,17 +16121,17 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context) case OMP_TEAMS: stmt = c_parser_omp_teams (loc, parser, p_name, OMP_TARGET_CLAUSE_MASK, - cclauses); + cclauses, if_p); break; case OMP_PARALLEL: stmt = c_parser_omp_parallel (loc, parser, p_name, OMP_TARGET_CLAUSE_MASK, - cclauses); + cclauses, if_p); break; case OMP_SIMD: stmt = c_parser_omp_simd (loc, parser, p_name, OMP_TARGET_CLAUSE_MASK, - cclauses); + cclauses, if_p); break; default: gcc_unreachable (); @@ -16123,15 +16144,18 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context) { case OMP_TEAMS: ret = c_parser_omp_teams (loc, parser, p_name, - OMP_TARGET_CLAUSE_MASK, cclauses); + OMP_TARGET_CLAUSE_MASK, cclauses, + if_p); break; case OMP_PARALLEL: ret = c_parser_omp_parallel (loc, parser, p_name, - OMP_TARGET_CLAUSE_MASK, cclauses); + OMP_TARGET_CLAUSE_MASK, cclauses, + if_p); break; case OMP_SIMD: ret = c_parser_omp_simd (loc, parser, p_name, - OMP_TARGET_CLAUSE_MASK, cclauses); + OMP_TARGET_CLAUSE_MASK, cclauses, + if_p); break; default: gcc_unreachable (); @@ -16182,7 +16206,7 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context) else if (strcmp (p, "data") == 0) { c_parser_consume_token (parser); - c_parser_omp_target_data (loc, parser); + c_parser_omp_target_data (loc, parser, if_p); return true; } else if (strcmp (p, "enter") == 0) @@ -16213,7 +16237,7 @@ c_parser_omp_target (c_parser *parser, enum pragma_context context) pc = &OMP_TARGET_CLAUSES (stmt); keep_next_level (); block = c_begin_compound_stmt (true); - add_stmt (c_parser_omp_structured_block (parser)); + add_stmt (c_parser_omp_structured_block (parser, if_p)); OMP_TARGET_BODY (stmt) = c_end_compound_stmt (loc, block, true); SET_EXPR_LOCATION (stmt, loc); @@ -17022,7 +17046,8 @@ c_parser_omp_declare (c_parser *parser, enum pragma_context context) static tree c_parser_omp_taskloop (location_t loc, c_parser *parser, - char *p_name, omp_clause_mask mask, tree *cclauses) + char *p_name, omp_clause_mask mask, tree *cclauses, + bool *if_p) { tree clauses, block, ret; @@ -17041,9 +17066,10 @@ c_parser_omp_taskloop (location_t loc, c_parser *parser, mask &= ~(OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_REDUCTION); c_parser_consume_token (parser); if (!flag_openmp) /* flag_openmp_simd */ - return c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + return c_parser_omp_simd (loc, parser, p_name, mask, cclauses, + if_p); block = c_begin_compound_stmt (true); - ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses); + ret = c_parser_omp_simd (loc, parser, p_name, mask, cclauses, if_p); block = c_end_compound_stmt (loc, block, true); if (ret == NULL) return ret; @@ -17070,7 +17096,7 @@ c_parser_omp_taskloop (location_t loc, c_parser *parser, } block = c_begin_compound_stmt (true); - ret = c_parser_omp_for_loop (loc, parser, OMP_TASKLOOP, clauses, NULL); + ret = c_parser_omp_for_loop (loc, parser, OMP_TASKLOOP, clauses, NULL, if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); @@ -17080,7 +17106,7 @@ c_parser_omp_taskloop (location_t loc, c_parser *parser, /* Main entry point to parsing most OpenMP pragmas. */ static void -c_parser_omp_construct (c_parser *parser) +c_parser_omp_construct (c_parser *parser, bool *if_p) { enum pragma_kind p_kind; location_t loc; @@ -17102,19 +17128,20 @@ c_parser_omp_construct (c_parser *parser) stmt = c_parser_oacc_cache (loc, parser); break; case PRAGMA_OACC_DATA: - stmt = c_parser_oacc_data (loc, parser); + stmt = c_parser_oacc_data (loc, parser, if_p); break; case PRAGMA_OACC_HOST_DATA: - stmt = c_parser_oacc_host_data (loc, parser); + stmt = c_parser_oacc_host_data (loc, parser, if_p); break; case PRAGMA_OACC_KERNELS: case PRAGMA_OACC_PARALLEL: strcpy (p_name, "#pragma acc"); - stmt = c_parser_oacc_kernels_parallel (loc, parser, p_kind, p_name); + stmt = c_parser_oacc_kernels_parallel (loc, parser, p_kind, p_name, + if_p); break; case PRAGMA_OACC_LOOP: strcpy (p_name, "#pragma acc"); - stmt = c_parser_oacc_loop (loc, parser, p_name, mask, NULL); + stmt = c_parser_oacc_loop (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OACC_WAIT: strcpy (p_name, "#pragma wait"); @@ -17124,22 +17151,22 @@ c_parser_omp_construct (c_parser *parser) c_parser_omp_atomic (loc, parser); return; case PRAGMA_OMP_CRITICAL: - stmt = c_parser_omp_critical (loc, parser); + stmt = c_parser_omp_critical (loc, parser, if_p); break; case PRAGMA_OMP_DISTRIBUTE: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_distribute (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_distribute (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OMP_FOR: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_for (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_for (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OMP_MASTER: - stmt = c_parser_omp_master (loc, parser); + stmt = c_parser_omp_master (loc, parser, if_p); break; case PRAGMA_OMP_PARALLEL: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_parallel (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_parallel (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OMP_SECTIONS: strcpy (p_name, "#pragma omp"); @@ -17147,24 +17174,24 @@ c_parser_omp_construct (c_parser *parser) break; case PRAGMA_OMP_SIMD: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_simd (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_simd (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OMP_SINGLE: - stmt = c_parser_omp_single (loc, parser); + stmt = c_parser_omp_single (loc, parser, if_p); break; case PRAGMA_OMP_TASK: - stmt = c_parser_omp_task (loc, parser); + stmt = c_parser_omp_task (loc, parser, if_p); break; case PRAGMA_OMP_TASKGROUP: - stmt = c_parser_omp_taskgroup (parser); + stmt = c_parser_omp_taskgroup (parser, if_p); break; case PRAGMA_OMP_TASKLOOP: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_taskloop (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_taskloop (loc, parser, p_name, mask, NULL, if_p); break; case PRAGMA_OMP_TEAMS: strcpy (p_name, "#pragma omp"); - stmt = c_parser_omp_teams (loc, parser, p_name, mask, NULL); + stmt = c_parser_omp_teams (loc, parser, p_name, mask, NULL, if_p); break; default: gcc_unreachable (); @@ -17491,7 +17518,7 @@ c_parser_cilk_all_clauses (c_parser *parser) */ static void -c_parser_cilk_grainsize (c_parser *parser) +c_parser_cilk_grainsize (c_parser *parser, bool *if_p) { extern tree convert_to_integer (tree, tree); @@ -17516,7 +17543,7 @@ c_parser_cilk_grainsize (c_parser *parser) { if (grain == NULL_TREE || grain == error_mark_node) grain = integer_zero_node; - c_parser_cilk_for (parser, grain); + c_parser_cilk_for (parser, grain, if_p); } else warning (0, "%<#pragma cilk grainsize%> is not followed by " @@ -17529,12 +17556,12 @@ c_parser_cilk_grainsize (c_parser *parser) /* Main entry point for parsing Cilk Plus <#pragma simd> for loops. */ static void -c_parser_cilk_simd (c_parser *parser) +c_parser_cilk_simd (c_parser *parser, bool *if_p) { tree clauses = c_parser_cilk_all_clauses (parser); tree block = c_begin_compound_stmt (true); location_t loc = c_parser_peek_token (parser)->location; - c_parser_omp_for_loop (loc, parser, CILK_SIMD, clauses, NULL); + c_parser_omp_for_loop (loc, parser, CILK_SIMD, clauses, NULL, if_p); block = c_end_compound_stmt (loc, block, true); add_stmt (block); } @@ -17559,7 +17586,7 @@ c_get_temp_regvar (tree type, tree init) GRAIN is the grain value passed in through pragma or 0. */ static void -c_parser_cilk_for (c_parser *parser, tree grain) +c_parser_cilk_for (c_parser *parser, tree grain, bool *if_p) { tree clauses = build_omp_clause (EXPR_LOCATION (grain), OMP_CLAUSE_SCHEDULE); OMP_CLAUSE_SCHEDULE_KIND (clauses) = OMP_CLAUSE_SCHEDULE_CILKFOR; @@ -17569,7 +17596,8 @@ c_parser_cilk_for (c_parser *parser, tree grain) tree block = c_begin_compound_stmt (true); tree sb = push_stmt_list (); location_t loc = c_parser_peek_token (parser)->location; - tree omp_for = c_parser_omp_for_loop (loc, parser, CILK_FOR, clauses, NULL); + tree omp_for = c_parser_omp_for_loop (loc, parser, CILK_FOR, clauses, NULL, + if_p); sb = pop_stmt_list (sb); if (omp_for) |