public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch to gcc/function] PR 58362
@ 2013-09-08 19:44 Paolo Carlini
  2013-09-09  7:53 ` Richard Biener
  0 siblings, 1 reply; 24+ messages in thread
From: Paolo Carlini @ 2013-09-08 19:44 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka, Richard Guenther

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

Hi,

this patchlet fixes the column # of the unused parameter warnings 
emitted by do_warn_unused_parameter by explicitly passing 
DECL_SOURCE_LOCATION (decl) instead of wrongly relying on '+', which in 
this case ends up meaning the location of the function declaration. 
Tested x86_64-linux.

Thanks!
Paolo.

PS: sorry, not 100% sure about the maintainers of this file, I'm adding 
a couple of CCs.

////////////////////////

[-- Attachment #2: CL_58362 --]
[-- Type: text/plain, Size: 339 bytes --]

2013-09-09  Marc Glisse  <marc.glisse@inria.fr>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58362
	* function.c (do_warn_unused_parameter): Use DECL_SOURCE_LOCATION.

/testsuite
2013-09-09  Marc Glisse  <marc.glisse@inria.fr>
	    Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58362
	* c-c++-common/Wunused-parm-1.c: New.

[-- Attachment #3: patch_58362 --]
[-- Type: text/plain, Size: 988 bytes --]

Index: function.c
===================================================================
--- function.c	(revision 202365)
+++ function.c	(working copy)
@@ -5004,7 +5004,8 @@ do_warn_unused_parameter (tree fn)
     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 %qD", decl);
 }
 
 /* Generate RTL for the end of the current function.  */
Index: testsuite/c-c++-common/Wunused-parm-1.c
===================================================================
--- testsuite/c-c++-common/Wunused-parm-1.c	(revision 0)
+++ testsuite/c-c++-common/Wunused-parm-1.c	(working copy)
@@ -0,0 +1,5 @@
+/* PR c++/58362 */
+/* { dg-options "-Wunused-parameter" } */
+/* { dg-do compile } */
+
+void f (long s) { }  /* { dg-warning "14:unused parameter" } */

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-09-09 12:54 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-08 19:44 [Patch to gcc/function] PR 58362 Paolo Carlini
2013-09-09  7:53 ` Richard Biener
2013-09-09  8:54   ` Paolo Carlini
2013-09-09  9:43     ` Richard Biener
2013-09-09  9:43       ` Richard Biener
2013-09-09  9:45         ` Jakub Jelinek
2013-09-09  9:46           ` Richard Biener
2013-09-09  9:57             ` Jakub Jelinek
2013-09-09 10:13               ` Richard Biener
2013-09-09 10:13                 ` Paolo Carlini
2013-09-09 10:14                   ` Paolo Carlini
2013-09-09 10:17                   ` Richard Biener
2013-09-09 10:23                     ` Paolo Carlini
2013-09-09 12:54                     ` Gabriel Dos Reis
2013-09-09 12:53                 ` Gabriel Dos Reis
2013-09-09 12:51               ` Gabriel Dos Reis
2013-09-09 10:09             ` Paolo Carlini
2013-09-09 10:44         ` Paolo Carlini
2013-09-09 10:50           ` Jakub Jelinek
2013-09-09 11:10             ` Paolo Carlini
2013-09-09 11:11               ` Paolo Carlini
2013-09-09 13:03             ` Gabriel Dos Reis
2013-09-09 12:54           ` Gabriel Dos Reis
2013-09-09  9:56       ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).