public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Lewis Hyatt <lhyatt@gmail.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] preprocessor: Set input_location to the most recently seen token
Date: Wed, 27 Jul 2022 17:28:20 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2207271728080.535398@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20220711211719.GA61164@ldh-imac.local>

On Mon, 11 Jul 2022, Lewis Hyatt via Gcc-patches wrote:

> Hello-
> 
> As discussed here:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598136.html
> 
> Here is another short patch that improves "#pragma GCC diagnostic" handling.
> Longer term, it will be desirable to make the handling of this pragma
> independent of the global input_location. But in the meantime, some glitches
> like this one can be readily addressed by making input_location point to
> something better. In this case, input_location during preprocessing (-E or
> -save-temps) is made to point to the most recently seen token rather than the
> beginning of the file. To the best of my knowledge, nothing else besides
> "#pragma GCC diagnostic" handling can observe input_location during
> token streaming, so this is expected not to have any other
> repercussions. Bootstrap + regtest does look clean on x86-64 Linux.
> 
> By the way, the new testcase fails when compiled with C++, but it's not
> because of pragma handling, it's rather because the C++ frontend changes the
> location on the warning to the wrong place. Once done_lexing has been set to
> true, it changes the location of all warnings to input_location, however
> that's not correct when the location is the cached location of a macro
> definition; the original location is preferable. I will file a separate PR
> about that, and have xfailed that testcase for now, since I am not quite there
> with grokking the reason it behaves this way, and anyway it's not related to
> this 1-line fix for gcc -E.
> 
> Please let me know how it looks? Thanks!

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2022-07-27 17:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 21:17 Lewis Hyatt
2022-07-27 17:28 ` Joseph Myers [this message]

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=alpine.DEB.2.22.394.2207271728080.535398@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lhyatt@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).