public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3014] openmp: For C++ ensure nothing directive has no operands
@ 2021-08-19  8:36 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-08-19  8:36 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4e6a5fa403782590088b2796261b023963f912af

commit r12-3014-g4e6a5fa403782590088b2796261b023963f912af
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Aug 19 10:35:39 2021 +0200

    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.

Diff:
---
 gcc/cp/parser.c                             | 2 +-
 gcc/testsuite/c-c++-common/gomp/nothing-2.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 04116fbcef4..1d48b8333fe 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 00000000000..a1520357be5
--- /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" } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-19  8:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  8:36 [gcc r12-3014] openmp: For C++ ensure nothing directive has no operands Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).