http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58362

            Bug ID: 58362
           Summary: Wrong column number for unused parameter
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

void f (long s) { }

y.cc:1:6: warning: unused parameter 's' [-Wunused-parameter]
 void f (long s) { }
      ^

Note the column information, which should point to s instead.
I tried the following:

--- function.c    (revision 202365)
+++ function.c    (working copy)
@@ -4997,21 +4997,22 @@ use_return_register (void)
 void
 do_warn_unused_parameter (tree fn)
 {
   tree decl;

   for (decl = DECL_ARGUMENTS (fn);
        decl; decl = DECL_CHAIN (decl))
     if (!TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
     && DECL_NAME (decl) && !DECL_ARTIFICIAL (decl)
     && !TREE_NO_WARNING (decl))
-      warning (OPT_Wunused_parameter, "unused parameter %q+D", decl);
+      warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter,
+          "unused parameter %q+D", decl);
 }

 /* Generate RTL for the end of the current function.  */

 void
 expand_function_end (void)
 {
   rtx clobber_after;

   /* If arg_pointer_save_area was referenced only from a nested

And I checked in gdb, the first argument of warning_at has the right column
information, but it is ignored :-(

Reply via email to