diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 24 |
2 files changed, 26 insertions, 7 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 894f5e7..5fb386c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,12 @@ +2019-10-12 Jakub Jelinek <jakub@redhat.com> + + * c-parser.c (c_parser_omp_context_selector): Improve error recovery. + For simd properties, put them directly into TREE_VALUE. + (c_finish_omp_declare_variant): Call c_omp_mark_declare_variant. + If c_omp_context_selector_matches is 0, don't add attribute, otherwise + add "omp declare variant base" attribute rather than + "omp declare variant". + 2019-10-11 Joseph Myers <joseph@codesourcery.com> * c-decl.c (declspecs_add_type): Use pedwarn_c11 for DFP types. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 2daaee8..9d0b2b6 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -19219,6 +19219,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) else properties = tree_cons (NULL_TREE, t, properties); } + else + return error_mark_node; if (c_parser_next_token_is (parser, CPP_COMMA)) c_parser_consume_token (parser); @@ -19263,6 +19265,8 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) else properties = tree_cons (NULL_TREE, t, properties); } + else + return error_mark_node; break; case CTX_PROPERTY_SIMD: if (parms == NULL_TREE) @@ -19280,7 +19284,7 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms) == error_mark_node ? NULL_TREE : parms, c); - properties = tree_cons (NULL_TREE, c, properties); + properties = c; break; default: gcc_unreachable (); @@ -19389,7 +19393,7 @@ c_parser_omp_context_selector_specification (c_parser *parser, tree parms) } /* Finalize #pragma omp declare variant after FNDECL has been parsed, and put - that into "omp declare variant" attribute. */ + that into "omp declare variant base" attribute. */ static void c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) @@ -19473,10 +19477,16 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) if (variant != error_mark_node) { C_DECL_USED (variant) = 1; - tree attr = tree_cons (get_identifier ("omp declare variant"), - build_tree_list (variant, ctx), - DECL_ATTRIBUTES (fndecl)); - DECL_ATTRIBUTES (fndecl) = attr; + tree construct = c_omp_get_context_selector (ctx, "construct", NULL); + c_omp_mark_declare_variant (match_loc, variant, construct); + if (c_omp_context_selector_matches (ctx)) + { + tree attr + = tree_cons (get_identifier ("omp declare variant base"), + build_tree_list (variant, ctx), + DECL_ATTRIBUTES (fndecl)); + DECL_ATTRIBUTES (fndecl) = attr; + } } } @@ -19486,7 +19496,7 @@ c_finish_omp_declare_variant (c_parser *parser, tree fndecl, tree parms) /* Finalize #pragma omp declare simd or #pragma omp declare variant clauses after FNDECL has been parsed, and put that into "omp declare simd" - or "omp declare variant" attribute. */ + or "omp declare variant base" attribute. */ static void c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms, |