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: RFC: Named warnings


> Warnings aren't so simple and hierarchical.

I think perhaps the types of warnings are, but the reason for enabling
them aren't.

> I'm sure we do not want a .gccrc, ...

Perhaps what we should support is that people have a "warnings.h"
that's chock full of pragmas for the project's warnings, then.  But
then you get into the issue of which takes precedence: the command
line or the pragma.

> Present code:
> 
>           /* Issue a warning if this is an ISO C 99 program or if -Wreturn-type
>              and this is a function, or if -Wimplicit; prefer the former
>              warning since it is more explicit.  */
>           if ((warn_implicit_int || warn_return_type || flag_isoc99)
>               && funcdef_flag)
>             warn_about_return_type = 1;
>           else if (warn_implicit_int || flag_isoc99)
>             pedwarn_c99 ("type defaults to `int' in declaration of `%s'",
>                          name);

I would think something like this:

	warn ("functions.retval.type-defaults", "...");

And somewhere *else* we figure out whether this warning should be
enabled or not based on the c89/c99/pedantic/-W options.

The "somewhere else" would have a table like this:

std.c99.pedantic = {
  functions.retval.type-defaults
}
std.c90 = {
  functions.retval.type-defaults
}

Or maybe allow attributes based on context:

std.c99 = {
  foo.bar
  functions.retval.type-defaults (pedantic)
  keywords.inline (error)
}


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