openmp: Reject #pragma omp atomic update, [PR101297]
authorJakub Jelinek <jakub@redhat.com>
Fri, 2 Jul 2021 19:57:24 +0000 (21:57 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 2 Jul 2021 19:57:24 +0000 (21:57 +0200)
commit2ca89394280da4afad6074ec3cb7136b6142af7b
tree040ffd0b44805914dd7c6bae2d9b5d71f3772ef3
parente3528ce197f8886869f95e8a8f901861a319851c
openmp: Reject #pragma omp atomic update, [PR101297]

I've noticed that we allow a trailing comma on OpenMP atomic construct
if there is at least one clause.  Commas should be only allowed to
separate the clauses (or in OpenMP 5.1 to separate directive name
from the clauses).

2021-07-02  Jakub Jelinek  <jakub@redhat.com>

PR c/101297
* c-parser.c (c_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.

* parser.c (cp_parser_omp_atomic): Consume comma only if it
appears before a CPP_NAME.

* c-c++-common/gomp/atomic-24.c: New test.
gcc/c/c-parser.c
gcc/cp/parser.c
gcc/testsuite/c-c++-common/gomp/atomic-24.c [new file with mode: 0644]