diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-11-14 09:12:10 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-11-14 09:12:10 +0100 |
commit | b2417b59d4be2e5e882dec5ae3b373f69331d6e2 (patch) | |
tree | b3d7af488c90ecd3476ef6b9d1f9e4cbfc00051b /gcc/c-family/c-omp.c | |
parent | f14713178d25db56903458432b0e3dbf35dbe840 (diff) | |
download | gcc-b2417b59d4be2e5e882dec5ae3b373f69331d6e2.zip gcc-b2417b59d4be2e5e882dec5ae3b373f69331d6e2.tar.gz gcc-b2417b59d4be2e5e882dec5ae3b373f69331d6e2.tar.bz2 |
omp-general.c (omp_context_name_list_prop): New function.
* omp-general.c (omp_context_name_list_prop): New function.
(omp_context_selector_matches): Use it. Return 0 if it returns
NULL.
(omp_context_selector_props_compare): Allow equivalency of an
identifier and a string literal containing no embedded zeros.
c-family/
* c-omp.c (c_omp_check_context_selector): Handle name lists
containing string literals. Don't diagnose atomic_default_mem_order
with multiple props.
c/
* c-parser.c (c_parser_omp_context_selector): Rename
CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
and string literals.
cp/
* parser.c (cp_parser_omp_context_selector): Rename
CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
identifier in that. For CTX_PROPERTY_NAME_LIST, allow identifiers
and string literals.
* pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
testsuite/
* c-c++-common/gomp/declare-variant-2.c: Adjust expected diagnostics,
add a test for atomic_default_mem_order with a string literal.
* c-c++-common/gomp/declare-variant-3.c: Use string literal props
in a few random places, add a few string literal prop related tests.
* c-c++-common/gomp/declare-variant-8.c: Likewise.
* c-c++-common/gomp/declare-variant-9.c: Use string literal props
in a few random places.
* c-c++-common/gomp/declare-variant-10.c: Likewise.
* c-c++-common/gomp/declare-variant-11.c: Likewise.
* c-c++-common/gomp/declare-variant-12.c: Likewise.
* g++.dg/gomp/declare-variant-7.C: Likewise.
From-SVN: r278202
Diffstat (limited to 'gcc/c-family/c-omp.c')
-rw-r--r-- | gcc/c-family/c-omp.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index e53461d..7d8eb32 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -2196,8 +2196,9 @@ c_omp_check_context_selector (location_t loc, tree ctx) { if (props[i].props[j] == NULL) { - if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), - " score")) + if (TREE_PURPOSE (t2) + && !strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), + " score")) break; if (props[i].props == atomic_default_mem_order) { @@ -2207,31 +2208,28 @@ c_omp_check_context_selector (location_t loc, tree ctx) "atomic_default_mem_order"); return error_mark_node; } - else + else if (TREE_PURPOSE (t2)) warning_at (loc, 0, "unknown property %qs of %qs selector", IDENTIFIER_POINTER (TREE_PURPOSE (t2)), props[i].selector); + else + warning_at (loc, 0, + "unknown property %qE of %qs selector", + TREE_VALUE (t2), props[i].selector); break; } - else if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), - props[i].props[j])) + else if (TREE_PURPOSE (t2) == NULL_TREE) { - if (props[i].props == atomic_default_mem_order - && t2 != TREE_VALUE (t1)) - { - tree t3 = TREE_VALUE (t1); - if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t3)), - " score") - && t2 == TREE_CHAIN (TREE_VALUE (t1))) - break; - error_at (loc, - "%qs selector must have a single property", - "atomic_default_mem_order"); - return error_mark_node; - } - break; + const char *str = TREE_STRING_POINTER (TREE_VALUE (t2)); + if (!strcmp (str, props[i].props[j]) + && ((size_t) TREE_STRING_LENGTH (TREE_VALUE (t2)) + == strlen (str) + 1)) + break; } + else if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), + props[i].props[j])) + break; } } return ctx; |