[Bug c/60014] New: Bad warning suppression

megahallon at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 31 21:27:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60014

            Bug ID: 60014
           Summary: Bad warning suppression
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: megahallon at gmail dot com

Using gcc 4.8.2:

/tmp/foo/foo.h:
-------------------------------
#define FOO(a, b) __LINE__;
-------------------------------

bug.c:
-------------------------------
#include "foo.h"

int main()
{
  FOO(1, 
      0);
  char* a = 1;
}
-------------------------------

$ /usr/bin/gcc bug.c -isystem /tmp/foo -no-integrated-cpp

should give a warning on line 7 but it not seen.

These works:

$ /usr/bin/gcc bug.c -isystem /tmp/foo -no-integrated-cpp
-ftrack-macro-expansion=0
$ /usr/bin/gcc bug.c -I /tmp/foo -no-integrated-cpp
$ /usr/bin/gcc bug.c -isystem /tmp/foo

-save-temps gives the same results as -no-integrated-cpp.

Output from -save-temps:

bug.i
-----------------------------
void main()
{

 6
# 5 "bug.c" 3 4
  ;
        ;
  char *a = 1;
}
-----------------------------

The suppress flag in the line directive apparently affects line 7 which is not
as expected.

In practice this means that ccache and similar systems that compiles
preprocessed output may fail to show warnings that are seen when compiling
normally.



More information about the Gcc-bugs mailing list