public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-11] openmp: For C++ ensure nothing directive has no operands
Date: Thu, 19 Aug 2021 10:11:01 +0000 (GMT)	[thread overview]
Message-ID: <20210819101101.B4E6F39B7052@sourceware.org> (raw)

https://gcc.gnu.org/g:23fcc7b6460a2698e1831ecd87e274bbc4e67e03

commit 23fcc7b6460a2698e1831ecd87e274bbc4e67e03
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Aug 19 12:03:03 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.
    
    (cherry picked from commit 4e6a5fa403782590088b2796261b023963f912af)

Diff:
---
 gcc/cp/ChangeLog.omp                        | 8 ++++++++
 gcc/cp/parser.c                             | 2 +-
 gcc/testsuite/ChangeLog.omp                 | 7 +++++++
 gcc/testsuite/c-c++-common/gomp/nothing-2.c | 2 ++
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 05614304769..c58f82443df 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2021-08-19  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backported from master:
+	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.
+
 2021-08-18  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from master:
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5b9d42f6ccf..c3274a265bd 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -45359,7 +45359,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/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 888162ba077..d64dae15792 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,10 @@
+2021-08-19  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backported from master:
+	2021-08-19  Jakub Jelinek  <jakub@redhat.com>
+
+	* c-c++-common/gomp/nothing-2.c: New test.
+
 2021-08-19  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from master:
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" } */


                 reply	other threads:[~2021-08-19 10:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210819101101.B4E6F39B7052@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).