[Bug c++/69126] [6 regression] _Pragma does not apply if part of a macro
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 7 18:44:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69126
--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #5)
[...snip...]
> That said, the location of the token from _Pragma looks wrong; note the
> underlines here:
>
> Breakpoint 2, handle_pragma_diagnostic (dummy=<optimized out>) at
> ../../src/gcc/c-family/c-pragma.c:760
> 760 kind = DK_IGNORED;
> (gdb) call inform (loc, "1st ignore")
> /tmp/test.cc: In function ‘int f()’:
> /tmp/test.cc:4:16: note: 1st ignore
> _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
> ^~~~~~~
> (gdb) cont
> Continuing.
>
> Breakpoint 2, handle_pragma_diagnostic (dummy=<optimized out>) at
> ../../src/gcc/c-family/c-pragma.c:760
> 760 kind = DK_IGNORED;
> (gdb) call inform (loc, "2nd ignore")
> /tmp/test.cc: In function ‘int g()’:
> /tmp/test.cc:17:16: note: 2nd ignore
> MACRO;
> ^
I got this slightly wrong, the locations passed to control_warning_option (and
thus put in the classification_history) are these:
(gdb) p loc
$1 = 173682
(gdb) call inform (loc, "1st ignore")
/tmp/test.cc: In function ‘int f()’:
/tmp/test.cc:4:24: note: 1st ignore
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
^~~~~~~~~~~~~~~~~~~
(gdb) p loc
$2 = 226930
(gdb) call inform (loc, "2nd ignore")
/tmp/test.cc: In function ‘int g()’:
/tmp/test.cc:17:24: note: 2nd ignore
MACRO;
^
(the above is trunk).
That said gcc 4.8.3 appears to generate similarly strange locations for these
tokens:
(gdb) p loc
$15 = 5428
(gdb) call inform (loc, "1st ignore")
/tmp/test.cc:4:24: note: 1st ignore
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
^
(gdb) p loc
$16 = 7092
(gdb) call inform (loc, "2nd ignore")
/tmp/test.cc: In function ‘int g()’:
/tmp/test.cc:17:24: note: 2nd ignore
MACRO;
^
More information about the Gcc-bugs
mailing list