Question about new warning system

Per Bothner per@bothner.com
Sat Jun 11 00:52:00 GMT 2005


Giovanni Bajo wrote:
> Actually, the point is that you *never* need to explicitally name the
> "warn_<foo>" variable unless you are optimizing. In other words, code which
> presently is:
> 
> if (warn_foo
>     && frobbed)
>    warning (0, "foo is frobbed");
> 
> should be replaced with:
> 
> if (frobbed)
>    warning (OPT_Wfoo, "foo is frobbed");

Perhaps a macro should be defined:

   maybe_warning (OPT_Wfoo, frobbed, "foo is frobbed");

This tests whether Wfoo is enabled *before* it evaluates frobbed.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Gcc mailing list