From: Martin Sebor Date: Fri, 27 Nov 2020 23:04:30 +0000 (-0700) Subject: Revert previous change and use pragma to suppress -Wformat-diag. X-Git-Tag: basepoints/gcc-12~2749 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb6b29c85c469bef65576d40dadd5e704a173bdd;p=thirdparty%2Fgcc.git Revert previous change and use pragma to suppress -Wformat-diag. gcc/cp/ChangeLog: * error.c (add_quotes): Revert previous change and use pragma to suppress -Wformat-diag. --- diff --git a/gcc/cp/error.c b/gcc/cp/error.c index ff701fc789d4..d11591d67a09 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -4061,10 +4061,6 @@ print_template_differences (pretty_printer *pp, tree type_a, tree type_b, pp_printf (pp, ">"); } -#if __GNUC__ >= 10 -# pragma GCC diagnostic pop -#endif - /* As type_to_string, but for a template, potentially colorizing/eliding in comparison with PEER. For example, if TYPE is map and PEER is map, @@ -4164,16 +4160,18 @@ add_quotes (const char *content, bool show_color) pretty_printer tmp_pp; pp_show_color (&tmp_pp) = show_color; - /* We use pp_quote & pp_string rather than pp_printf with "%<%s%>" - or "%qs" here in order to avoid quoting colorization bytes within - the results, and to avoid -Wformat-diag. */ - pp_quote (&tmp_pp); - pp_string (&tmp_pp, content); - pp_quote (&tmp_pp); + /* We have to use "%<%s%>" rather than "%qs" here in order to avoid + quoting colorization bytes within the results and using either + pp_quote or pp_begin_quote doesn't work the same. */ + pp_printf (&tmp_pp, "%<%s%>", content); return pp_ggc_formatted_text (&tmp_pp); } +#if __GNUC__ >= 10 +# pragma GCC diagnostic pop +#endif + /* If we had %H and %I, and hence deferred printing them, print them now, storing the result into the chunk_info for pp_format. Quote them if 'q' was provided.