https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
Summary|pragma GCC diagnostic |%+D in diagnostics breaks
|ignored "-Wunused-function" |pragma GCC diagnostic
|has incorrect scope |
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
I think this is because this warning uses:
warning ((TREE_CODE (decl) == FUNCTION_DECL)
? OPT_Wunused_function
: OPT_Wunused_variable,
"%q+D defined but not used", decl);
instead of:
warning_at (DECL_SOURCE_LOCATION (decl),
(TREE_CODE (decl) == FUNCTION_DECL)
? OPT_Wunused_function
: OPT_Wunused_variable,
"%qD defined but not used", decl);
and the pragma location check is done before processing the format string, so
the location is not set correctly. As I said several times, "+D" is not only
cryptic, it is also buggy because it is handled too late and too deep in the
diagnostics machinery to modify the location of the diagnostic ('+' would be
more intuitive as 'extra verbose' output).
Every diagnostic using +D is broken in this respect.
On the other hand, I do not understand how it was working in GCC 4.8.