H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
On Tue, Nov 24, 2020 at 5:13 PM Martin Sebor via Gcc-patches
<gcc-patches@gcc.gnu.org> 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,
Also on x86_64 Darwin
this caused:
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
map<.*\n \[\.\.\.\],.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
map<.*\n \[\.\.\.\],.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
map<.*\n \[\.\.\.\],.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-22 not found: "\s*could not convert
' \[01m \[Kvec \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n fn_1
\( \[01;31m \[Kvec \[m \[K\);.*\n
\[01;31m \[K\^~~ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kvector<double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-22 not found: "\s*could not convert
' \[01m \[Kvec \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n fn_1
\( \[01;31m \[Kvec \[m \[K\);.*\n
\[01;31m \[K\^~~ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kvector<double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-22 not found: "\s*could not convert
' \[01m \[Kvec \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n fn_1
\( \[01;31m \[Kvec \[m \[K\);.*\n
\[01;31m \[K\^~~ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kvector<double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 31-35 not found: "could not convert
' \[01m \[Km \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
fn_2 \( \[01;31m \[Km \[m \[K\);.*\n
\[01;31m \[K\^ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kmap<\[\.\.\.\],double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 31-35 not found: "could not convert
' \[01m \[Km \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
fn_2 \( \[01;31m \[Km \[m \[K\);.*\n
\[01;31m \[K\^ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kmap<\[\.\.\.\],double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 31-35 not found: "could not convert
' \[01m \[Km \[m \[K' from
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<\[\.\.\.\], \[01;32m \[Kint \[m \[K> \[m \[K'.*\n
fn_2 \( \[01;31m \[Km \[m \[K\);.*\n
\[01;31m \[K\^ \[m \[K.*\n \[01;31m \[K\| \[m \[K.*\n
\[01;31m \[Kmap<\[\.\.\.\],double> \[m \[K.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-labels.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 18-20 not found: "\s*could not convert
' \[01m \[Kvector<double>\(\) \[m \[K' from
' \[01m \[Kvector< \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kvector< \[01;32m \[Kint \[m \[K> \[m \[K'.*\n vector<.*\n
\[ \[01;32m \[Kdouble \[m \[K != \[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<int, \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<int, \[01;32m \[Kint \[m \[K> \[m \[K'.*\n map<.*\n
int,.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<int, \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<int, \[01;32m \[Kint \[m \[K> \[m \[K'.*\n map<.*\n
int,.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so expected multiline
pattern lines 25-28 not found: "could not convert ' \[01m \[Kmap<int,
double>\(\) \[m \[K' from
' \[01m \[Kmap<int, \[01;32m \[Kdouble \[m \[K> \[m \[K' to
' \[01m \[Kmap<int, \[01;32m \[Kint \[m \[K> \[m \[K'.*\n map<.*\n
int,.*\n \[ \[01;32m \[Kdouble \[m \[K !=
\[01;32m \[Kint \[m \[K\]>.*\n"
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/show-template-tree-color-no-elide-type.C
-fplugin=./show_template_tree_color_plugin.so (test for excess errors)
--
H.J.