aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2020-11-27 16:04:30 -0700
committerMartin Sebor <msebor@redhat.com>2020-11-27 16:06:18 -0700
commitfb6b29c85c469bef65576d40dadd5e704a173bdd (patch)
treeddb3da2213f52da8adcd909d56b3534c98733a5a
parent9ccffd1298b5235b25ad05b89e3104fb2935fe27 (diff)
downloadgcc-fb6b29c85c469bef65576d40dadd5e704a173bdd.zip
gcc-fb6b29c85c469bef65576d40dadd5e704a173bdd.tar.gz
gcc-fb6b29c85c469bef65576d40dadd5e704a173bdd.tar.bz2
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.
-rw-r--r--gcc/cp/error.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ff701fc..d11591d 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<int,double> and PEER is map<int,int>,
@@ -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.