aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-08-19 10:35:39 +0200
committerJakub Jelinek <jakub@redhat.com>2021-08-19 10:35:39 +0200
commit4e6a5fa403782590088b2796261b023963f912af (patch)
treebc83d5b21497169269892394f49a4f0a9f5eed7e
parenteea1677fd03a1cb820cbb72044d4a0770f8a7a93 (diff)
downloadgcc-4e6a5fa403782590088b2796261b023963f912af.zip
gcc-4e6a5fa403782590088b2796261b023963f912af.tar.gz
gcc-4e6a5fa403782590088b2796261b023963f912af.tar.bz2
openmp: For C++ ensure nothing directive has no operands
When working on error directive, I've noticed that while C FE diagnosed clauses on nothing directive which doesn't allow any, the C++ FE silently accepted it. 2021-08-19 Jakub Jelinek <jakub@redhat.com> * parser.c (cp_parser_omp_nothing): Use cp_parser_require_pragma_eol instead of cp_parser_skip_to_pragma_eol. * c-c++-common/gomp/nothing-2.c: New test.
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/nothing-2.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 04116fb..1d48b83 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -45570,7 +45570,7 @@ cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok)
static void
cp_parser_omp_nothing (cp_parser *parser, cp_token *pragma_tok)
{
- cp_parser_skip_to_pragma_eol (parser, pragma_tok);
+ cp_parser_require_pragma_eol (parser, pragma_tok);
}
diff --git a/gcc/testsuite/c-c++-common/gomp/nothing-2.c b/gcc/testsuite/c-c++-common/gomp/nothing-2.c
new file mode 100644
index 0000000..a152035
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/nothing-2.c
@@ -0,0 +1,2 @@
+#pragma omp nothing , /* { dg-error "expected end of line before" } */
+#pragma omp nothing asdf /* { dg-error "expected end of line before" } */