aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-10-12 10:27:36 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-10-12 10:27:36 +0200
commit20de9568b49e663be848a35ce0bb08f63f14b5b2 (patch)
tree302f44f3d609ab83db0ef9a7e4ec5aeb4287965e /gcc/cp/parser.c
parent47370f050940a2e140e89fc0d46e808fab206f04 (diff)
downloadgcc-20de9568b49e663be848a35ce0bb08f63f14b5b2.zip
gcc-20de9568b49e663be848a35ce0bb08f63f14b5b2.tar.gz
gcc-20de9568b49e663be848a35ce0bb08f63f14b5b2.tar.bz2
c-common.h (c_omp_mark_declare_variant, [...]): Declare.
c-family/ * c-common.h (c_omp_mark_declare_variant, c_omp_context_selector_matches): Declare. * c-omp.c: Include attribs.h, gimplify.h, cgraph.h, symbol-summary.h and hsa-common.h. (c_omp_get_context_selector): Support second argument NULL. (c_omp_mark_declare_variant, c_omp_context_selector_matches): New functions. * c-attribs.c (c_common_attribute_table): Remove "omp declare variant" attribute, add "omp declare variant base" and "omp declare variant variant" attributes. c/ * 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". cp/ * parser.c (cp_parser_omp_context_selector): Improve error recovery. For simd properties, put them directly into TREE_VALUE. (cp_finish_omp_declare_variant): Add "omp declare variant base" attribute rather than "omp declare variant". testsuite/ * c-c++-common/gomp/declare-variant-2.c: Adjust for error recovery improvements. Add new tests. * c-c++-common/gomp/declare-variant-4.c: New test. * c-c++-common/gomp/declare-variant-5.c: New test. * c-c++-common/gomp/declare-variant-6.c: New test. * c-c++-common/gomp/declare-variant-7.c: New test. From-SVN: r276914
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3ee8da7..9bf690a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -40488,6 +40488,8 @@ cp_parser_omp_context_selector (cp_parser *parser, tree set, bool has_parms_p)
else
properties = tree_cons (NULL_TREE, t, properties);
}
+ else
+ return error_mark_node;
if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
cp_lexer_consume_token (parser->lexer);
@@ -40532,6 +40534,8 @@ cp_parser_omp_context_selector (cp_parser *parser, tree set, bool has_parms_p)
else
properties = tree_cons (NULL_TREE, t, properties);
}
+ else
+ return error_mark_node;
break;
case CTX_PROPERTY_SIMD:
if (!has_parms_p)
@@ -40541,11 +40545,10 @@ cp_parser_omp_context_selector (cp_parser *parser, tree set, bool has_parms_p)
"%<metadirective%>");
return error_mark_node;
}
- tree c;
- c = cp_parser_omp_all_clauses (parser,
+ properties
+ = cp_parser_omp_all_clauses (parser,
OMP_DECLARE_SIMD_CLAUSE_MASK,
"simd", NULL, true, true);
- properties = tree_cons (NULL_TREE, c, properties);
break;
default:
gcc_unreachable ();
@@ -40662,7 +40665,7 @@ cp_parser_omp_context_selector_specification (cp_parser *parser,
}
/* Finalize #pragma omp declare variant after a fndecl has been parsed, and put
- that into "omp declare variant" attribute. */
+ that into "omp declare variant base" attribute. */
static tree
cp_finish_omp_declare_variant (cp_parser *parser, cp_token *pragma_tok,
@@ -40717,7 +40720,7 @@ cp_finish_omp_declare_variant (cp_parser *parser, cp_token *pragma_tok,
ctx = c_omp_check_context_selector (match_loc, ctx);
if (ctx != error_mark_node && variant != error_mark_node)
{
- attrs = tree_cons (get_identifier ("omp declare variant"),
+ attrs = tree_cons (get_identifier ("omp declare variant base"),
build_tree_list (variant, ctx), attrs);
if (processing_template_decl)
ATTR_IS_DEPENDENT (attrs) = 1;