From: Manuel López-Ibáñez Date: Fri, 24 Jul 2015 20:20:13 +0000 (+0000) Subject: re PR c++/64079 (%+D in diagnostics breaks pragma GCC diagnostic) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=274d8c11f37abd11a3a43b5bd129c194b0daeafc;p=gcc.git re PR c++/64079 (%+D in diagnostics breaks pragma GCC diagnostic) 2015-07-24 Manuel López-Ibáñez PR c++/64079 * toplev.c (check_global_declaration): Use DECL_SOURCE_LOCATION and "%qD" in warning_at instead of "%q+D" in warning. /testsuite 2015-07-24 Manuel López-Ibáñez PR c++/64079 * c-c++-common/Wunused-function-1.c: New. From-SVN: r226191 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 773babe6d3c..264570832f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-07-24 Manuel López-Ibáñez + + PR c++/64079 + * toplev.c (check_global_declaration): Use DECL_SOURCE_LOCATION + and "%qD" in warning_at instead of "%q+D" in warning. + 2015-07-24 Uros Bizjak * config/i386/i386.c (ix86_call_abi_override): Call ix86_function_abi. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9db26430e07..57bb26d014e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-24 Manuel López-Ibáñez + + PR c++/64079 + * c-c++-common/Wunused-function-1.c: New. + 2015-07-24 Tom de Vries * gcc.dg/parloops-exit-first-loop-alt-2.c: Use debug print for diff --git a/gcc/testsuite/c-c++-common/Wunused-function-1.c b/gcc/testsuite/c-c++-common/Wunused-function-1.c new file mode 100644 index 00000000000..9f856952b2e --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wunused-function-1.c @@ -0,0 +1,10 @@ +/* PR c++/64079 */ +/* { dg-do compile } */ +/* { dg-options "-Wunused-function" } */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" + +static void bar() {} + +#pragma GCC diagnostic pop diff --git a/gcc/toplev.c b/gcc/toplev.c index 91be24f7bca..1bacb68889d 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -524,10 +524,11 @@ check_global_declaration (tree decl) && !DECL_STATIC_DESTRUCTOR (decl))) /* Otherwise, ask the language. */ && lang_hooks.decls.warn_unused_global (decl)) - warning ((TREE_CODE (decl) == FUNCTION_DECL) - ? OPT_Wunused_function - : OPT_Wunused_variable, - "%q+D defined but not used", decl); + warning_at (DECL_SOURCE_LOCATION (decl), + (TREE_CODE (decl) == FUNCTION_DECL) + ? OPT_Wunused_function + : OPT_Wunused_variable, + "%qD defined but not used", decl); } /* Compile an entire translation unit. Write a file of assembly