From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E31263857809 for ; Thu, 20 Jan 2022 10:17:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E31263857809 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-EzapsgP7P2q1N-Mj4mZVcQ-1; Thu, 20 Jan 2022 05:17:31 -0500 X-MC-Unique: EzapsgP7P2q1N-Mj4mZVcQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 805E983DD25; Thu, 20 Jan 2022 10:17:30 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.40.192.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16E4C4F850; Thu, 20 Jan 2022 10:17:29 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 20KAHSq4053100 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 20 Jan 2022 11:17:28 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 20KAHS7C053099; Thu, 20 Jan 2022 11:17:28 +0100 Date: Thu, 20 Jan 2022 11:17:28 +0100 From: Jakub Jelinek To: Martin =?utf-8?B?TGnFoWth?= Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix Werror=format-diag with --disable-nls. Message-ID: <20220120101728.GG2646553@tucnak> Reply-To: Jakub Jelinek References: <9532d734-eac1-eecb-6dbe-cd0a7fc55b36@suse.cz> MIME-Version: 1.0 In-Reply-To: <9532d734-eac1-eecb-6dbe-cd0a7fc55b36@suse.cz> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 10:17:36 -0000 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