On Sat, 10 Apr 2021 at 11:30, Sidney Marshall <sidn...@frontiernet.net> wrote: > > When compiling the last few releases of GCC I get many warnings in > format strings of the form: > > ../../gcc-10.3.0/gcc/analyzer/region-model.cc: In member function > 'void ana::svalue_id::dump_node_name_to_pp(pretty_printer*) const': > ../../gcc-10.3.0/gcc/analyzer/region-model.cc:205:19: warning: > unquoted identifier or keyword 'svalue_' in format [-Wformat-diag] > 205 | pp_printf (pp, "svalue_%i", m_idx); > | ^~~~~~~ > ../../gcc-10.3.0/gcc/analyzer/region-model.cc: In member function > 'void ana::region_id::dump_node_name_to_pp(pretty_printer*) const': > ../../gcc-10.3.0/gcc/analyzer/region-model.cc:235:19: warning: > unquoted identifier or keyword 'region_' in format [-Wformat-diag] > 235 | pp_printf (pp, "region_%i", m_idx); > | ^~~~~~~ > ../../gcc-10.3.0/gcc/analyzer/region-model.cc: In member function > 'virtual void ana::svalue::dump_dot_to_pp(const ana::region_model&, > ana::svalue_id, pretty_printer*) const': > ../../gcc-10.3.0/gcc/analyzer/region-model.cc:377:26: warning: > spurious trailing punctuation sequence '="' in format [-Wformat-diag] > 377 | pp_printf (pp, " [label=\""); > | ^~~ > ../../gcc-10.3.0/gcc/analyzer/region-model.cc:377:20: warning: > unbalanced punctuation character '[' in format [-Wformat-diag] > 377 | pp_printf (pp, " [label=\""); > | ^ > ../../gcc-10.3.0/gcc/analyzer/region-model.cc: In member function > 'virtual void ana::region::dump_dot_to_pp(const ana::region_model&, > ana::region_id, pretty_printer*) const': > ../../gcc-10.3.0/gcc/analyzer/region-model.cc:1382:72: warning: > spurious trailing punctuation sequence '="' in format [-Wformat-diag] > 1382 | printf (pp, " > [shape=none,margin=0,style=filled,fillcolor=%s,label=\"", > | ^~~ > > These warnings seem spurious to me. > > Are these warnings truly spurious or is there som part of the > standard I don't understand?
These are nothing to do with the standard. These are internal warnings produced by GCC checking its own diagnostic strings (i.e. the strings used for warnings and errors that GCC prints when compiling your code). There are checks to ensure we don't print errors with mismatched quotes, or unclosed parentheses. Sometimes the checks give false positives, e.g. because a diagnostic is built up in pieces, and the checks only look at a single piece at a time, rather than the finished result. You can ignore them.