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|                            |jason at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot com

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Trivial patch, but the issue remains that any use of '+' is potentially a bug.

Index: toplev.c
===================================================================
--- toplev.c    (revision 225868)
+++ toplev.c    (working copy)
@@ -522,14 +522,15 @@ check_global_declaration (tree decl)
       && (TREE_CODE (decl) != FUNCTION_DECL
          || (!DECL_STATIC_CONSTRUCTOR (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
    output and various debugging dumps.  */

Reply via email to