[Bug c/59495] -ftrack-macro-expansion=2 ignores warnings originated from /usr/include headers

2013-12-15 Thread doront at mellanox dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59495

--- Comment #3 from Doron Tsur doront at mellanox dot com ---
It is probably a false positive bug - warning is undetected.

Consider the following code:

$ cat define_compare_test.c
#include define_compare_test.h
#include stdio.h

int main(int argc __attribute__((unused)), char** argv __attribute__((unused)))
{
const int number_int = -1;
const unsigned int number_unsigned_int = 0x;

printf(%d and %u are %s\n, number_int, number_unsigned_int,
   DEFINE_COMPARE(number_int, number_unsigned_int) );
return 0;
}

$ cat define_compare_test/define_compare_test.h

#define DEFINE_COMPARE(X,Y) \
((X)==(Y)) ? equal : different

$ ... cp -v define_compare_test/define_compare_test.h /usr/include
'define_compare_test/define_compare_test.h' -
'/usr/include/define_compare_test.h'

$ gcc -Wall -Wextra -Werror  define_compare_test.c -I define_compare_test -H
. define_compare_test/define_compare_test.h 
...
In file included from define_compare_test.c:1:0:
define_compare_test.c: In function 'main':
define_compare_test/define_compare_test.h:3:7: error: comparison between signed
and unsigned integer expressions [-Werror=sign-compare]
   ((X)==(Y)) ? equal : different
   ^
define_compare_test.c:9:9: note: in expansion of macro 'DEFINE_COMPARE'
 DEFINE_COMPARE(number_int, number_unsigned_int) );
 ^
Multiple include guards may be useful for:
/usr/include/wchar.h
...
/usr/include/x86_64-linux-gnu/gnu/stubs.h
define_compare_test/define_compare_test.h
cc1: all warnings being treated as errors

$ gcc -Wall -Wextra -Werror  define_compare_test.c -H
. /usr/include/define_compare_test.h
. /usr/include/stdio.h
...
Multiple include guards may be useful for:
/usr/include/define_compare_test.h
/usr/include/wchar.h
...
$ ./a.out
-1 and 4294967295 are equal


[Bug c/59495] -ftrack-macro-expansion=2 ignores warnings originated from /usr/include headers

2013-12-13 Thread mpolacek at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59495

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek mpolacek at gcc dot gnu.org ---
I'd say it's because in maybe_unwind_expanded_macro_loc we've got

  /* Walk LOC_VEC and print the macro expansion trace, unless the
 first macro which expansion triggered this trace was expanded
 inside a system header.  */
  int saved_location_line =
expand_location_to_spelling_point (diagnostic-location).line;

  if (!LINEMAP_SYSP (map))
FOR_EACH_VEC_ELT (loc_vec, ix, iter)
  {   
...
  }


[Bug c/59495] -ftrack-macro-expansion=2 ignores warnings originated from /usr/include headers

2013-12-13 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59495

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||manu at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #2 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
See the discussion in PR55252, specially comments #3 and #9.

*** This bug has been marked as a duplicate of bug 55252 ***