Hi,

I think this can go in, given Jason's feedback in the audit trail of the bug. I'm going to wait until the end of the day, anyway. Tested x86_64-linux.

Thanks,
Paolo.

////////////////
2015-07-24  Manuel López-Ibáñez  <m...@gcc.gnu.org>

        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  <m...@gcc.gnu.org>

        PR c++/64079
        * c-c++-common/Wunused-function-1.c: New.
Index: testsuite/c-c++-common/Wunused-function-1.c
===================================================================
--- testsuite/c-c++-common/Wunused-function-1.c (revision 0)
+++ testsuite/c-c++-common/Wunused-function-1.c (working copy)
@@ -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
Index: toplev.c
===================================================================
--- toplev.c    (revision 226121)
+++ toplev.c    (working copy)
@@ -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

Reply via email to