On 9/14/21 3:43 AM, Basile Starynkevitch wrote:
On 9/14/21 11:32 AM, Martin Liška wrote:
On 9/10/21 15:05, Basile Starynkevitch wrote:
Hello all,
In the Bismon static source code analyzer on
https://github.com/bstarynk/bismon/ commit ad8b6270691e
(funded by http://decoder-project.eu/ ....) which contains some
GPLv3+ GCC plugin code under directory gccplugins/
I am getting when compiling it
gcc10_metaplugin_BMGCC.cc: In function ‘int
plugin_init(plugin_name_args*, plugin_gcc_version*)’:
gcc10_metaplugin_BMGCC.cc:165:85: warning: unquoted whitespace
character ‘\x0a’ in format [-Wformat-diag]
165 | warning(UNKNOWN_LOCATION, "BISMON GCC10 METAPLUGIN:
datestamp difference for %s:\n"
| ^~~
166 | " plugin has %s, GCC had %s; this is risky.",
| ~~
gcc10_metaplugin_BMGCC.cc:169:84: warning: unquoted whitespace
character ‘\x0a’ in format [-Wformat-diag]
169 | warning(UNKNOWN_LOCATION, "BISMON GCC10 METAPLUGIN:
devphase difference for %s:\n"
| ^~~
170 | " plugin has %s, GCC had %s; this is risky.",
| ~~
gcc10_metaplugin_BMGCC.cc:174:89: warning: unquoted whitespace
character ‘\x0a’ in format [-Wformat-diag]
174 | warning(UNKNOWN_LOCATION, "BISMON GCC10 METAPLUGIN:
configuration difference for %s:\n"
| ^~~
175 | " plugin has %s, GCC had %s; this is risky.",
| ~~
gcc10_metaplugin_BMGCC.cc: In function ‘void
parse_plugin_arguments(const char*, plugin_name_args*)’:
gcc10_metaplugin_BMGCC.cc:405:53: warning: unquoted sequence of 2
consecutive space characters in format [-Wformat-diag]
405 | inform (UNKNOWN_LOCATION, "Bismon plugin %qs (%s:%d)
will handle GCC include-file events with prefix %qs",
| ^~
Hello.
The warning -Wformat-diag is internal GCC warning that hasn't been
documented. I'm CC'ing the warning author.
Where can I read the complete specification of % escape sequences for
inform?
You can read it just in source code if I'm correct, that's the only
option you have:
gcc/c-family/c-format.c:3031.
Sorry, even after looking inside it (function check_tokens presumably),
I don't understand them.
Could anyone on the list give a better explanation, or at least a dozen
of examples covering most of the cases!
-Wformat-diag detects common spelling mistakes in GCC diagnostic
messages and deviations from an internal GCC style conventions for
them. The instances above point out uses of the line-feed character
('\x0a') in the warning text that should either be quoted or avoided.
The last instance notes the use of two consecutive spaces where just
one should be used.
The conventions are documented here:
https://gcc.gnu.org/codingconventions.html
-Wformat-diag is normally only issued when compiling GCC itself.
As an GCC-internal option useful only to GCC developers it's not
mentioned in the user manual. It might make sense to document
it either in the Developer Options section or in the Internals
manual. Probably the best place to look to understand them is
the testsuite:
gcc/testsuite/gcc.dg/format/gcc_diag-11.c
Similarly, the GCC-internal format directives like %qs are only
described in GCC sources. They vary somewhat from one part of GCC
to another and the documentation is scattered throughout. The base
subset is discussed here:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/pretty-print.c;h=ade1933f86a0e5c4ab75e58e0bc6b269ccb4cfe2;hb=7ca388565af176bd4efd4f8db1e5e9e11e98ef45#l1025
Martin