This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib: Suppress warnings in system headers
On Mon, Aug 21, 2000 at 08:43:31PM +0100, Neil Booth wrote:
> Zack Weinberg wrote:-
>
> > This seems to be the right general idea. I have one concern: I
> > believe there are some cpp_pedwarn() calls that are not predicated on
> > CPP_PEDANTIC. These are mandatory warnings that happen to be also
> > mandated by ISO C (so we want -pedantic-errors to make them into
> > errors). You need to find these and give them a way to do what they
> > need. (cpp_mandatory_pedwarn? I don't mind the long name, these should
> > be rare.)
>
> I don't fully see what you mean.
Your patch causes all cpp_pedwarn() calls to be silent, everywhere, if
CPP_OPTION (pfile, pedantic) is false. This means you don't have to
test CPP_PEDANTIC() before calling cpp_pedwarn(), which is a good
idea.
But there were calls to cpp_pedwarn that didn't test CPP_PEDANTIC at
all. For example, cppexp.c:parse_number:
if (base <= largest_digit)
cpp_pedwarn (pfile, "integer constant contains digits beyond the radix");
if (overflow)
cpp_pedwarn (pfile, "integer constant out of range");
Those pedwarns happen whether or not -pedantic is given on the command
line. If -pedantic-errors is given, they are errors instead of
warnings, which is why they don't use plain cpp_warning().
With your patch, those warnings would happen only with -pedantic. I
don't think that's an appropriate change.
> If what you're suggesting requires adding another category (I hope it
> doesn't), can we at the same time move to
>
> cpp_diag ();
> cpp_diag_with_line ();
> cpp_diag_with_file_and_line ();
>
> where each takes an argument indicating severity, and scrap the
> cpp_pedwarn, cpp_warning etc. Otherwise we start to swim in a sea of
> endless variations.
Rather than doing this ourselves, I'd prefer we look at using
diagnostic.c instead. I think that's feasible with GDR's recent
changes, and it's where we want to go in the long run. I'm not
opposed to this change to the *interface*, but we should be trying to
reduce the number of error reporting routines overall, not just in
cpplib.
zw