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


>       if (OPT_Wmissing_braces)
>            warning (OPT_Wmissing_braces, "missing braces around
> initializer");

FYI OPT_Wmissing_braces is an enum constant; it will always be nonzero.

> [3]
>       warning (OPT_Wmissing_braces, "missing braces around initializer");

That is what we decided to do.

Note, however, if the logic required to determine if a warning is
warranted is sufficiently complex, *also* checking the variable is
considered an optimization:

	if (warn_missing_braces
	    && expensive_warning_check())
	  warning (OPT_Wmissing_braces, "...");

In this case, the warn_missing_braces check is done only to avoid
calling expensive_warning_check() if we know in advance we won't be
needing it.


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