On Thu, May 12, 2005 at 03:46:41PM -0400, DJ Delorie wrote:
>
> How to convert this code? There is no single OPT_* that reflects when
> the first warning is emitted.
>
> if (params == 0 && (warn_format_nonliteral || warn_format_security))
> warning (0, "format not a string literal and no format arguments");
> else
> warning (OPT_Wformat_nonliteral,
> "format not a string literal, argument types not checked");
How about this?
if (params == 0 && (warn_format_nonliteral || warn_format_security))
warning (warn_format_security ? OPT_Wformat_security :
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");
The only useful difference being that you don't have to duplicate the
string.
--
Daniel Jacobowitz
CodeSourcery, LLC