public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix Werror=format-diag with --disable-nls.
Date: Thu, 20 Jan 2022 11:17:28 +0100	[thread overview]
Message-ID: <20220120101728.GG2646553@tucnak> (raw)
In-Reply-To: <9532d734-eac1-eecb-6dbe-cd0a7fc55b36@suse.cz>

On Thu, Jan 20, 2022 at 10:43:55AM +0100, Martin Liška wrote:
> The patch disables "-Wformat-diag" for dump_aggr_type.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> 	PR c++/104134
> 
> gcc/cp/ChangeLog:
> 
> 	* error.cc (dump_aggr_type): Partially disable the warning.
> ---
>  gcc/cp/error.cc | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
> index 1ab0c25a477..c031c75cc5e 100644
> --- a/gcc/cp/error.cc
> +++ b/gcc/cp/error.cc
> @@ -768,6 +768,11 @@ class_key_or_enum_as_string (tree t)
>      return "struct";
>  }
> +#if __GNUC__ >= 10
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Wformat-diag"
> +#endif
> +
>  /* Print out a class declaration T under the control of FLAGS,
>     in the form `class foo'.  */
> @@ -851,6 +856,10 @@ dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
>  			 flags & ~TFF_TEMPLATE_HEADER);
>  }
> +#if __GNUC__ >= 10
> +#pragma GCC diagnostic pop
> +#endif
> +

Please add an empty line above #if lines.
Also, it would be nice to use the same style of these at least in the
same file.  The others are:

/* Disable warnings about missing quoting in GCC diagnostics for
   the pp_verbatim calls.  Their format strings deliberately don't
   follow GCC diagnostic conventions.  */
#if __GNUC__ >= 10
#  pragma GCC diagnostic push
#  pragma GCC diagnostic ignored "-Wformat-diag"
#endif

and

#if __GNUC__ >= 10
#  pragma GCC diagnostic pop
#endif

The 2 spaces between # and pragma look just weird, so either
use in all the 4 spaces 1 space between # and pragma, or 0 spaces.
And also the copy the comment from above the other diagnostic push,
perhaps with small tweak (pp_verbatim -> pp_printf)?

Otherwise LGTM.

	Jakub


  reply	other threads:[~2022-01-20 10:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20  9:43 Martin Liška
2022-01-20 10:17 ` Jakub Jelinek [this message]
2022-01-20 10:28   ` Jakub Jelinek
2022-01-20 16:33     ` Martin Sebor
2022-01-20 16:43       ` Jakub Jelinek
2022-01-20 16:56         ` Martin Sebor
2022-01-20 17:03           ` Jakub Jelinek
2022-01-20 17:52             ` Martin Sebor
2022-01-20 18:18               ` 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=20220120101728.GG2646553@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).