This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mixing warning flags


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]