aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-function-1.c10
-rw-r--r--gcc/toplev.c9
4 files changed, 26 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 773babe..2645708 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-24 Manuel López-Ibáñez <manu@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.
+
2015-07-24 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.c (ix86_call_abi_override): Call ix86_function_abi.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9db2643..57bb26d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-24 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/64079
+ * c-c++-common/Wunused-function-1.c: New.
+
2015-07-24 Tom de Vries <tom@codesourcery.com>
* 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 0000000..9f85695
--- /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 91be24f..1bacb68 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