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]

Re: Desire gcc option to skip warnings in standard headers


| > I don't like this, I think the new option should turn
| > warning off if used, but by default give warnings for
| > system headers too.
| 
| That's trivial to do, of course -- most probably I should just invert the
| meaning of the option. What about the name of the option, though? I don't like
| -W(no-)system-headers, even though I thought it up myself...

Hmm, it appears to be not logical...
Looking at most other -W options.

A #pragma seems more logical, and more flexible too.

Other compilers allow to turn off each type of
warning seperately with a #pragma, which would be
the ideal.  It would introduce a boolean for each type
of warning, and I imagine we need an array for that:
An array that contains these variables, and the warnings
and some code that is used.

struct warning {
  short warn_code;
  const char *format;
  unsigned int flags;	// Contains flag to turn it on/off with a #pragma
};

enum {
  warnFoo
  ...
};

struct warning warnings[] = {
  { warnFoo, "You're not allowed to foo around: %s", pendanticWarning },
  ...

...

  print_warning(warnFoo, error);

...


Doesn't that look nice? :)

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>


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