public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Martin Sebor <msebor@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Joseph Myers <joseph@codesourcery.com>,
	David Malcolm <dmalcolm@redhat.com>
Subject: Re: [Patch] libcpp: Fix _Pragma expansion [PR102409]
Date: Sat, 30 Oct 2021 01:43:37 +0200	[thread overview]
Message-ID: <90989236-9fad-29c6-9bf0-ec0d5237b3b8@codesourcery.com> (raw)
In-Reply-To: <fa948caf-21f8-a1ee-f664-20060104094c@gmail.com>

Hi Martin,

On 28.10.21 18:28, Martin Sebor wrote:
> There are a number of bug reports of _Pragma not working right
> in macros, including (and especially) to control diagnostics:
> https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=_Pragma%20macro&list_id=328003
>
>
> Just by the description this change seems like it could also
> fix some of them.

I think it does not help with them – or only partially.

I believe there currently still two issues:

* _Pragma("GCC foo") – when "foo" or "GCC foo" are
   not registered is immediately processed, leading
   to wrong placement in the output with "-E".

A probably not fully correct draft patch is attached to
https://gcc.gnu.org/PR90400 which fixes the issue
(misses a location before the #pragma).


* With _Pragma("GCC diagnostic") in macros the problem is:
The macro is replaced by all the macro code including the
#pragma and all other code in there.

By construction, all those have the same line. But if
   else { b--;
#pragma GCC diagnostic push
;
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
; a--;
#pragma GCC diagnostic pop
; }

the location is the input_location of the expanded macro,
i.e. all code is in the same line. As the 'pop' check checks
whether the loc is before the pragma, it might pop too early
and the 'ignored' is already ignored for the 'a--' in this
example.  Cf. https://gcc.gnu.org/PR91669

@Martin: As you seem to have spare cycles, how about spending
some time fixing either issue?

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2021-10-29 23:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 15:51 Tobias Burnus
2021-10-28 16:28 ` Martin Sebor
2021-10-29 23:43   ` Tobias Burnus [this message]
2021-10-29 11:06 ` Jakub Jelinek
2021-10-29 16:20   ` Tobias Burnus
2021-10-29 16:29     ` Jakub Jelinek

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=90989236-9fad-29c6-9bf0-ec0d5237b3b8@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=msebor@gmail.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).