From: Lewis Hyatt <lhyatt@gmail.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431]
Date: Wed, 6 Jul 2022 15:41:09 -0400 [thread overview]
Message-ID: <CAA_5UQ67-p0_q96S1rGaK93Nt3+h1XDNkrdWBhCndNTOM8xzPA@mail.gmail.com> (raw)
In-Reply-To: <e5569a72-5120-89eb-89f2-1bd14a5b6600@redhat.com>
On Wed, Jul 6, 2022 at 2:17 PM Jason Merrill <jason@redhat.com> wrote:
>> On 7/6/22 10:23, Lewis Hyatt wrote:
> > Here is an updated patch addressing all your comments, thanks again for the
> > review. Regarding the idea about rewinding tokens, it seems potentially
> > problematic to try to make use of libcpp's backup token feature. I think there
> > can be pragmas which allow macro expansion, and then libcpp is not able to
> > step back through the expansion AFAIK. It would work fine for `#pragma GCC
> > diagnostic' but would break if a similar approach was added for some other
> > pragma allowing expansion in the future, and I think potentially also for
> > _Pragma. But it seems pretty tenable to handle this case just by providing an
> > interface in c-ppoutput.c to ask it to stream a given token that you have
> > lexed external to the token streaming process. That's how I set it up here,
> > it's much better than my first way IMHO, hopefully it looks OK?
> >
> > I also attached a diff of this version vs the previous version in case that
> > makes it easier to review. The C++ parts were not touched other than adding
> > the comment you suggested, the changes in this version are mostly in
> > c-ppoutput.cc and c-pragma.cc.
>
>
> > +/* When preprocessing only, pragma_lex() is not available, so obtain the tokens
> > + directly from libcpp. We also need to inform the token streamer about all
> > + tokens we lex ourselves here, so it outputs them too; this is done by calling
> > + c_pp_stream_token () for each. */
>
> Let's add to this comment
>
> ??? If we need to support more pragmas in the future, maybe initialize
> this_parser with the pragma tokens and call pragma_lex?
>
> OK with that change.
>
Thank you very much, done.
-Lewis
prev parent reply other threads:[~2022-07-06 19:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 17:03 Lewis Hyatt
2022-06-29 16:59 ` Jason Merrill
2022-07-01 19:59 ` Jason Merrill
2022-07-01 22:05 ` Lewis Hyatt
2022-07-02 0:23 ` Jason Merrill
2022-07-06 14:23 ` Lewis Hyatt
2022-07-06 18:17 ` Jason Merrill
2022-07-06 19:41 ` Lewis Hyatt [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=CAA_5UQ67-p0_q96S1rGaK93Nt3+h1XDNkrdWBhCndNTOM8xzPA@mail.gmail.com \
--to=lhyatt@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.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).