On 11/26/20 8:42 AM, H.J. Lu wrote:
On Tue, Nov 24, 2020 at 5:13 PM Martin Sebor via Gcc-patches <[email protected]> wrote:The attached patch cleans up most remaining -Wformat-diag instances in an x86_64-build. I tried to minimize using #pragma diagnostic so I tweaked the code instead. A preferable solution might be to introduce a new format attribute and used it to exempt the pp_printf() and verbatim() functions from some of the -Wformat-diag checks but that would require more surgery on the warning code than I think is called for at this point. Tested by bootstrapping all of the languages below (same set I test all my patches with) and regtesting: ada,brig,c,c++,d,fortran,jit,lto,objc,obj-c++On Linux/x86-64, this caused: FAIL: g++.dg/plugin/show-template-tree-color.C
Apparently pp_printf (&tmp_pp, "%<%s%>", content); doesn't produce the same output as pp_quote (&tmp_pp); pp_string (&tmp_pp, content); pp_quote (&tmp_pp); I spent an hour trying all sorts of permutations of pp_begin_quote (cxx_pp, whatever); pp_string (&tmp_pp, content); pp_end_quote (cxx_pp, whatever); to coax it to produce the expected output but no luck so I gave up, reverted the change, and just suppressed the warning using #pragma GCC diagnostic. Martin
