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: named warnings & individual warning control


> >Also, -O[23] tends to confuse this as they defer the use of warning
> >flags until after the whole file is parsed, so pragmas between
> >function definitions don't do what you expect :-(
>
> I'm not sure what to say about the problem in the last paragraph; that's 
> clearly a serious user interface issue.  This is part of why I have long 
> argued that only front ends should be permitted to issue warnings, and 
> that all attempts to use back-end data flow analysis to issue warnings 
> are mistaken, no matter how clever they seem.

If we keep track of the input_location info with the warning control
state, we can get around this problem.  Then we'd also not need the
API for obtaining the warning state and keeping track of it.

Summary:

Take our existing functions, like warning(), and add a parameter that
indicates the warning group the message is in.  We can mechanically
add "0" for starters, and expand from there.  Using OPT_* for the
group ties us in to the existing options.

Add #pragma to enable/disable warning groups.  Keep track of the state
of the warning controls, when a warning comes through we find the
right state based on file/line info.

Eventually we'll define useful warning groups, and move control of
those groups into the diagnostic code (i.e. out of c-opt.c).  We can
also move the conditional logic there (i.e. the if (warn_*) ...).

Eventually groups will be defined with enough resolution to
effectively give control over individual warnings (although some might
have multiple wordings).

We can also, in parallel, replace the old "if (warn_*)" code with "if
(warn_p(OPT_*))" where it's still needed, and get rid of a lot of
global variables (plus allow for more interesting logic for some
warnings).


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