This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] New flag -Wsystem-headers
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: [patch] New flag -Wsystem-headers
- From: Neil Booth <NeilB at earthling dot net>
- Date: Wed, 27 Sep 2000 08:10:52 +0100
Benjamin Kosnik wrote:-
> > The patch has caused (I think) two regressions (but you weren't cc-ed
> > on the mail about regressions). Any ideas?
>
> > >gcc/testsuite/gcc.sum:FAIL: gcc.dg/cpp/syshdr.c (test for excess errors)
> > >gcc/testsuite/gcc.sum:FAIL: gcc.dg/wtr-int-type-1.c decimal constant (test for warnings, line 40)
>
> Not quite sure if they are related to -Wsystem-headers. Perhaps
> -Wno-system-headers could be used for these files...
No, the bug in cpplib was introduced by the macro changes
(e.g. CPP_PEDANTIC) for error reporting without updating the logic in
cpperror.c to compensate. I think the patch below fixes it for
cpplib. I'm bootstrapping it and have to go to my day job now, so I
won't be committing it for at least 12 hrs.
Could you investigate what changed for the front ends to cause
wtr-int-type-1.c to fail? At a glance, I don't think that has
anything to do with the preprocessor, and is probably a similar logic
problem.
Neil.
* cpperror.c (_cpp_begin_message): Do the test for suppression
of warnings and pedantic warnings before the "is a warning an
error" tests.
Index: cpperror.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpperror.c,v
retrieving revision 1.38
diff -c -p -r1.38 cpperror.c
*** cpperror.c 2000/09/25 22:54:02 1.38
--- cpperror.c 2000/09/27 07:03:38
*************** _cpp_begin_message (pfile, code, file, l
*** 120,130 ****
switch (code)
{
case WARNING:
if (! CPP_OPTION (pfile, warnings_are_errors))
{
if (CPP_OPTION (pfile, inhibit_warnings)
- || (CPP_IN_SYSTEM_HEADER (pfile)
- && ! CPP_OPTION (pfile, warn_system_headers)))
return 0;
is_warning = 1;
}
--- 120,131 ----
switch (code)
{
case WARNING:
+ if (CPP_IN_SYSTEM_HEADER (pfile)
+ && ! CPP_OPTION (pfile, warn_system_headers))
+ return 0;
if (! CPP_OPTION (pfile, warnings_are_errors))
{
if (CPP_OPTION (pfile, inhibit_warnings)
return 0;
is_warning = 1;
}
*************** _cpp_begin_message (pfile, code, file, l
*** 138,148 ****
break;
case PEDWARN:
if (! CPP_OPTION (pfile, pedantic_errors))
{
! if (CPP_OPTION (pfile, inhibit_warnings)
! || (CPP_IN_SYSTEM_HEADER (pfile)
! && ! CPP_OPTION (pfile, warn_system_headers)))
return 0;
is_warning = 1;
}
--- 139,150 ----
break;
case PEDWARN:
+ if (CPP_IN_SYSTEM_HEADER (pfile)
+ && ! CPP_OPTION (pfile, warn_system_headers))
+ return 0;
if (! CPP_OPTION (pfile, pedantic_errors))
{
! if (CPP_OPTION (pfile, inhibit_warnings))
return 0;
is_warning = 1;
}