public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Thomas Schwinge <thomas@codesourcery.com>,
	gcc-patches@gcc.gnu.org, Andrew Stubbs <ams@codesourcery.com>,
	Hafiz Abid Qadeer <abidh@codesourcery.com>,
	doko@debian.org, David Malcolm <dmalcolm@redhat.com>
Subject: Re: '#pragma GCC diagnostic' (mis-)use in 'statement' of 'if'
Date: Tue, 20 Jul 2021 22:16:14 +0200	[thread overview]
Message-ID: <20210720201614.GH2380545@tucnak> (raw)
In-Reply-To: <21cf55d5-9a95-dd71-a939-10883d781b7f@gmail.com>

On Tue, Jul 20, 2021 at 01:47:01PM -0600, Martin Sebor wrote:
> > Addressing that is for another day.
> 
> David Malcolm (CC'd) has a patch attached to pr63326 to issue
> a warning to point out that #pragmas are treated as statements
> that would help prevent this type of a bug.  David, do you still
> plan to submit it?

That patch doesn't look correct.
c_parser_pragma and cp_parser_pragma is already told if it appears
in a context for which treating the pragma as standalone statement changes
the behavior and in contexts where it doesn't - pragma_stmt stands
for the problematic ones, pragma_compound for the correct ones (there are
other values for namespace scope, class scope etc.).
OpenMP/OpenACC pragmas shouldn't be touched, those already do the right
thing the standard asks for, for the remaining ones there should be a
warning for the pragma_stmt cases.

	Jakub


  reply	other threads:[~2021-07-20 20:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 23:11 [PATCH libatomic/arm] avoid warning on constant addresses (PR 101379) Martin Sebor
2021-07-15  8:33 ` Christophe Lyon
2021-07-16 17:42 ` Thomas Schwinge
2021-07-16 21:11   ` Martin Sebor
2021-07-19  8:49     ` Thomas Schwinge
2021-07-17 22:28   ` Andrew Stubbs
2021-07-19  8:46     ` [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' (was: [PATCH libatomic/arm] avoid warning on constant addresses (PR 101379)) Thomas Schwinge
2021-07-19  8:56       ` Jakub Jelinek
2021-07-19 11:10       ` Andrew Stubbs
2021-07-20  7:23       ` [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]' Thomas Schwinge
2021-07-20  8:40         ` '#pragma GCC diagnostic' (mis-)use in 'statement' of 'if' (was: [gcn] Work-around libgomp 'error: array subscript 0 is outside array bounds of ‘__lds struct gomp_thread * __lds[0]’ [-Werror=array-bounds]') Thomas Schwinge
2021-07-20 19:47           ` '#pragma GCC diagnostic' (mis-)use in 'statement' of 'if' Martin Sebor
2021-07-20 20:16             ` Jakub Jelinek [this message]
2021-07-21 16:41 ` [PATCH libatomic/arm] avoid warning on constant addresses (PR 101379) Kyrylo Tkachov
2021-07-21 16:54   ` Martin Sebor

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=20210720201614.GH2380545@tucnak \
    --to=jakub@redhat.com \
    --cc=abidh@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=dmalcolm@redhat.com \
    --cc=doko@debian.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@gmail.com \
    --cc=thomas@codesourcery.com \
    /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).