From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 226F43857C6B; Thu, 20 Jan 2022 11:03:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 226F43857C6B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6760] Fix Werror=format-diag with --disable-nls. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: e744aa373d215d1e8b3f4102a71b26b385dababc X-Git-Newrev: 6d51a27fb17d9dc4e583c119fd976d39e575180f Message-Id: <20220120110320.226F43857C6B@sourceware.org> Date: Thu, 20 Jan 2022 11:03:20 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 11:03:20 -0000 https://gcc.gnu.org/g:6d51a27fb17d9dc4e583c119fd976d39e575180f commit r12-6760-g6d51a27fb17d9dc4e583c119fd976d39e575180f Author: Martin Liska Date: Thu Jan 20 09:30:01 2022 +0100 Fix Werror=format-diag with --disable-nls. PR c++/104134 gcc/cp/ChangeLog: * error.cc (dump_aggr_type): Partially disable the warning. Diff: --- gcc/cp/error.cc | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 1ab0c25a477..e76842e1a2a 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -768,6 +768,14 @@ class_key_or_enum_as_string (tree t) return "struct"; } +/* Disable warnings about missing quoting in GCC diagnostics for + the pp_verbatim call. Their format strings deliberately don't + follow GCC diagnostic conventions. */ +#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 +859,10 @@ dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags) flags & ~TFF_TEMPLATE_HEADER); } +#if __GNUC__ >= 10 +#pragma GCC diagnostic pop +#endif + /* Dump into the obstack the initial part of the output for a given type. This is necessary when dealing with things like functions returning functions. Examples: @@ -3618,8 +3630,8 @@ function_category (tree fn) 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" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-diag" #endif /* Report the full context of a current template instantiation, @@ -4230,7 +4242,7 @@ add_quotes (const char *content, bool show_color) } #if __GNUC__ >= 10 -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif /* If we had %H and %I, and hence deferred printing them,