public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431]
@ 2022-06-23 17:03 Lewis Hyatt
  2022-06-29 16:59 ` Jason Merrill
  0 siblings, 1 reply; 8+ messages in thread
From: Lewis Hyatt @ 2022-06-23 17:03 UTC (permalink / raw)
  To: gcc-patches

Hello-

https://gcc.gnu.org/pipermail/gcc-patches/2022-May/595556.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431#c49

Would a C++ maintainer have some time to take a look at this patch
please? I feel like the PR is still worth resolving. If this doesn't
seem like a good way, I am happy to try another -- would really
appreciate any feedback. Thanks!

-Lewis

On Tue, May 24, 2022 at 5:28 PM Lewis Hyatt <lhyatt@gmail.com> wrote:
>
> Hello-
>
> Now that we're back in stage 1, I thought it might be a better time to
> ask for feedback on this pair of patches that tries to resolve PR53431
> please?
>
> https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587357.html
> https://gcc.gnu.org/pipermail/gcc-patches/2021-December/587358.html
>
> Part 1/2 is a trivial cleanup in the C++ parser that simplifies
> adding the support for early pragma handling.
>
> Part 2/2 adds the concept of early pragma handling and makes the C++
> and preprocessor frontends use it.
>
> The patches required some minor rebasing, so I have attached updated
> versions here.
>
> bootstrap + regtest all languages still looks good:
>
> FAIL 103 103
> PASS 541178 541213
> UNSUPPORTED 15177 15177
> UNTESTED 136 136
> XFAIL 4140 4140
> XPASS 17 17
>
> Thanks! If this approach doesn't seem like the right one, I am happy
> to try another way.
>
> -Lewis
>
>
> On Fri, Dec 24, 2021 at 04:23:08PM -0500, Lewis Hyatt wrote:
> > Hello-
> >
> > I would like please to follow up on this patch submitted for PR53431 here:
> > https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586191.html
> >
> > However, it was suggested on the PR that part of it could be split into a
> > separate simpler patch. I have now done that, and also made a few tweaks to
> > the first version at the same time, so may I please request that you review
> > this version 2 instead? This email contains the first smaller cleanup patch,
> > and the next email contains the main part of it. Thanks very much.
> >
> > bootstrap and regtest were performed on x86-64 Linux, all tests look the same
> > before + after, plus the new passing testcases.
> >
> > FAIL 112 112
> > PASS 528007 528042
> > UNSUPPORTED 14888 14888
> > UNTESTED 132 132
> > XFAIL 3238 3238
> > XPASS 17 17
> >
> > -Lewis
>
> > From: Lewis Hyatt <lhyatt@gmail.com>
> > Date: Thu, 23 Dec 2021 17:03:04 -0500
> > Subject: [PATCH] c++: Minor cleanup in parser.c
> >
> > The code to determine whether a given token starts a module directive is
> > currently repeated in 4 places in parser.c. I am about to submit a patch
> > that needs to add it in a 5th place, so since the code is not completely
> > trivial (needing to check for 3 different token types), it seems worthwhile
> > to factor this logic into its own function.
> >
> > gcc/cp/ChangeLog:
> >
> >       * parser.c (cp_token_is_module_directive): New function
> >       refactoring common code.
> >       (cp_parser_skip_to_closing_parenthesis_1): Use the new function.
> >       (cp_parser_skip_to_end_of_statement): Likewise.
> >       (cp_parser_skip_to_end_of_block_or_statement): Likewise.
> >       (cp_parser_declaration): Likewise.
> >
> > diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
> > index 33fb40a5b59..9b7446655be 100644
> > --- a/gcc/cp/parser.c
> > +++ b/gcc/cp/parser.c
> > @@ -629,6 +629,16 @@ cp_lexer_alloc (void)
> >    return lexer;
> >  }
> >
> > +/* Return TRUE if token is the start of a module declaration that will be
> > +   terminated by a CPP_PRAGMA_EOL token.  */
> > +static inline bool
> > +cp_token_is_module_directive (cp_token *token)
> > +{
> > +  return token->keyword == RID__EXPORT
> > +    || token->keyword == RID__MODULE
> > +    || token->keyword == RID__IMPORT;
> > +}
> > +
> >  /* Create a new main C++ lexer, the lexer that gets tokens from the
> >     preprocessor.  */
> >
> > @@ -3805,9 +3815,7 @@ cp_parser_skip_to_closing_parenthesis_1 (cp_parser *parser,
> >         break;
> >
> >       case CPP_KEYWORD:
> > -       if (token->keyword != RID__EXPORT
> > -           && token->keyword != RID__MODULE
> > -           && token->keyword != RID__IMPORT)
> > +       if (!cp_token_is_module_directive (token))
> >           break;
> >         /* FALLTHROUGH  */
> >
> > @@ -3908,9 +3916,7 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser)
> >         break;
> >
> >       case CPP_KEYWORD:
> > -       if (token->keyword != RID__EXPORT
> > -           && token->keyword != RID__MODULE
> > -           && token->keyword != RID__IMPORT)
> > +       if (!cp_token_is_module_directive (token))
> >           break;
> >         /* FALLTHROUGH  */
> >
> > @@ -3997,9 +4003,7 @@ cp_parser_skip_to_end_of_block_or_statement (cp_parser* parser)
> >         break;
> >
> >       case CPP_KEYWORD:
> > -       if (token->keyword != RID__EXPORT
> > -           && token->keyword != RID__MODULE
> > -           && token->keyword != RID__IMPORT)
> > +       if (!cp_token_is_module_directive (token))
> >           break;
> >         /* FALLTHROUGH  */
> >
> > @@ -14860,9 +14864,7 @@ cp_parser_declaration (cp_parser* parser, tree prefix_attrs)
> >        else
> >       cp_parser_module_export (parser);
> >      }
> > -  else if (token1->keyword == RID__EXPORT
> > -        || token1->keyword == RID__IMPORT
> > -        || token1->keyword == RID__MODULE)
> > +  else if (cp_token_is_module_directive (token1))
> >      {
> >        bool exporting = token1->keyword == RID__EXPORT;
> >        cp_token *next = exporting ? token2 : token1;
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-06 19:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 17:03 Ping^2: [PATCH v2] diagnostics: Honor #pragma GCC diagnostic in the preprocessor [PR53431] 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 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).