diff options
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r-- | gcc/c/c-parser.cc | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index d49d5c5..22ec0f8 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -20519,7 +20519,10 @@ c_parser_omp_clause_detach (c_parser *parser, tree list) static tree c_parser_omp_clause_destroy (c_parser *parser, tree list) { - return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_DESTROY, list); + tree nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_DESTROY, list); + for (tree c = nl; c != list; c = OMP_CLAUSE_CHAIN (c)) + TREE_ADDRESSABLE (OMP_CLAUSE_DECL (c)) = 1; + return nl; } /* OpenMP 5.1: @@ -20834,8 +20837,8 @@ c_parser_omp_clause_init_modifiers (c_parser *parser, bool *target, while (true); fail: - c_parser_error (parser, "%<init%> clause with modifier other than " - "%<prefer_type%>, %<target%> or %<targetsync%>"); + c_parser_error (parser, + "expected %<prefer_type%>, %<target%>, or %<targetsync%>"); return false; } @@ -20856,51 +20859,30 @@ c_parser_omp_clause_init (c_parser *parser, tree list) if (!parens.require_open (parser)) return list; - unsigned raw_pos = 1; - while (c_parser_peek_nth_token_raw (parser, raw_pos)->type == CPP_NAME) - { - raw_pos++; - if (c_parser_peek_nth_token_raw (parser, raw_pos)->type == CPP_OPEN_PAREN) - { - raw_pos++; - c_parser_check_balanced_raw_token_sequence (parser, &raw_pos); - if (c_parser_peek_nth_token_raw (parser, raw_pos)->type != CPP_CLOSE_PAREN) - { - raw_pos = 0; - break; - } - raw_pos++; - } - if (c_parser_peek_nth_token_raw (parser, raw_pos)->type == CPP_COLON) - break; - if (c_parser_peek_nth_token_raw (parser, raw_pos)->type != CPP_COMMA) - { - raw_pos = 0; - break; - } - raw_pos++; - } - bool target = false; bool targetsync = false; tree prefer_type_tree = NULL_TREE; - if (raw_pos > 1 - && (!c_parser_omp_clause_init_modifiers (parser, &target, &targetsync, - &prefer_type_tree) - || !c_parser_require (parser, CPP_COLON, "expected %<:%>"))) + if (!c_parser_omp_clause_init_modifiers (parser, &target, &targetsync, + &prefer_type_tree) + || !c_parser_require (parser, CPP_COLON, "expected %<:%>")) { if (prefer_type_tree != error_mark_node) parens.skip_until_found_close (parser); return list; } + if (!target && !targetsync) + error_at (loc, + "missing required %<target%> and/or %<targetsync%> modifier"); + tree nl = c_parser_omp_variable_list (parser, loc, OMP_CLAUSE_INIT, list, false); parens.skip_until_found_close (parser); for (tree c = nl; c != list; c = OMP_CLAUSE_CHAIN (c)) { + TREE_ADDRESSABLE (OMP_CLAUSE_DECL (c)) = 1; if (target) OMP_CLAUSE_INIT_TARGET (c) = 1; if (targetsync) @@ -27162,6 +27144,10 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) || !c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%> or %<,%>")) goto fail; + if (!target && !targetsync) + error_at (loc, + "missing required %<target%> and/or " + "%<targetsync%> modifier"); tree t = build_tree_list (target ? boolean_true_node : boolean_false_node, targetsync ? boolean_true_node |