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: Question about new warning system


>    maybe_warning (OPT_Wfoo, frobbed, "foo is frobbed");
> 
> This tests whether Wfoo is enabled *before* it evaluates frobbed.

In the cases where such a check is warranted, "frobbed" is usually a
fairly large collection of tests.  It would be impractical (and ugly)
to put such logic inside a macro call.

There is a option_enabled() function which takes an OPT_* and returns
nonzer if the option is enabled, in case you lose track of which OPT_*
goes with which warn_* (or if the variable doesn't exist, or is other
than a simple integer).  But it's easier to use the warn_* variables
for such cases.


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