This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: mixing warning flags
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 12 May 2005 20:41:44 +0000 (UTC)
- Subject: Re: mixing warning flags
- References: <200505121946.j4CJkff6004956@greed.delorie.com>
On Thu, 12 May 2005, DJ Delorie wrote:
> if (params == 0 && warn_format_security)
> warning (OPT_Wformat_security,
> "format not a string literal and no format arguments");
> els if (params == 0 && warn_format_nonliteral)
> warning (OPT_Wformat_nonliteral,
> "format not a string literal and no format arguments");
> else
> warning (OPT_Wformat_nonliteral,
> "format not a string literal, argument types not checked");
This appears to reflect the correct logic.
-Wformat-security happens to be a subset of -Wformat-nonliteral at present
but needn't always be so. To reflect the logical intent of these options
while passing a unique OPT_* to each warning call, you'd need to add an
option -Wformat-security-nonliteral for the warnings in the intersection
of the two options; make -Wformat-security and -Wformat-nonliteral enable
it; add a testcase that -Wformat-security-nonliteral does the same as
-Wformat-security; and add a testcase that -Wformat-nonliteral
-Wno-format-security-nonliteral gives only the other warnings from
-Wformat-nonliteral. The value of so doing is doubtful unless you have
users who really do want all the -Wformat-nonliteral warnings except those
in -Wformat-security.
--
Joseph S. Myers
joseph@codesourcery.com