openmp: Fix ICE on requires clause with atomic_default_mem_order (
authorJakub Jelinek <jakub@redhat.com>
Thu, 19 Aug 2021 08:38:19 +0000 (10:38 +0200)
committerJakub Jelinek <jakub@redhat.com>
Thu, 19 Aug 2021 08:42:57 +0000 (10:42 +0200)
commitc04d766942274da89b236c4cb7e954b26da397c7
treeabd34947fbbcc9dcab8d534ca41f856f3af47d45
parentcb23be4fa59be26a7ba08918d6973e1d94629f8a
openmp: Fix ICE on requires clause with atomic_default_mem_order (

When working on error directive, I've noticed the C FE ICEs on
  #pragma omp requires atomic_default_mem_order (
where it tries to peek 2nd token after the CPP_PRAGMA_EOL (or CPP_EOF)
in there in order to improve error-recovery on say
atomic_default_mem_order (acquire)
or
atomic_default_mem_order (seqcst)
etc.  The C++ FE didn't ICE, but it is better to follow the same thing there.

2021-08-19  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
* c-parser.c (c_parser_omp_requires): Don't call
c_parser_peek_2nd_token and optionally consume token if current
token is CPP_EOF, CPP_PRAGMA_EOL or CPP_CLOSE_PAREN.
gcc/cp/
* parser.c (cp_parser_omp_requires): Don't call cp_lexer_nth_token_is
and optionally consume token if current token is CPP_EOF,
CPP_PRAGMA_EOL or CPP_CLOSE_PAREN.
gcc/testsuite/
* c-c++-common/gomp/requires-3.c: Add testcase for
atomic_default_mem_order ( at the end of line without corresponding ).
gcc/c/c-parser.c
gcc/cp/parser.c
gcc/testsuite/c-c++-common/gomp/requires-3.c