From patchwork Sun Sep 8 19:25:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 273453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 78B662C007A for ; Mon, 9 Sep 2013 05:25:30 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=ysrp23OgRCAbFqCRkp2HfBtKWWusjwsWgoQ15k9T/Jt 9bvCRIM35gSPwOi2OBc1n7aozCYZGj+0RJ+IMWXzueKseKOwLIzVrwttPGhgZHYj esGARr/ngmOG+lzUTymiAWI8nhXDaW2Ayv7i042dzWTPc88+uCGpzwiWEC3HWQKw = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=Waw6li+ziyuJAoaQq4BqrmGIhUU=; b=vOCh2OpSkhy+lyJ0+ UAH6kH5K3qnhGrbCyLpm405nqpzl191L+Enn0Qk5mt7/3U+bHNwtvGKLKdKtXOBq ewxOnOS32laeJjABdtIkROoteuIJSkp0MApG+28cpiFVclRJaKV/u16D6rsRO4rK qcFSS3H809zm4y5S7kcfIPvqHE= Received: (qmail 24087 invoked by alias); 8 Sep 2013 19:25:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 24075 invoked by uid 89); 8 Sep 2013 19:25:22 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 08 Sep 2013 19:25:22 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_SOFTFAIL, UNPARSEABLE_RELAY autolearn=no version=3.3.2 X-HELO: aserp1040.oracle.com Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r88JPIoI011529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 8 Sep 2013 19:25:19 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r88JPHPF027978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Sep 2013 19:25:18 GMT Received: from abhmt101.oracle.com (abhmt101.oracle.com [141.146.116.53]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r88JPHH5027975; Sun, 8 Sep 2013 19:25:17 GMT Received: from poldo4.casa (/79.43.214.237) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 08 Sep 2013 12:25:17 -0700 Message-ID: <522CCF1B.8080007@oracle.com> Date: Sun, 08 Sep 2013 21:25:15 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jan Hubicka , Richard Guenther Subject: [Patch to gcc/function] PR 58362 X-IsSubscribed: yes 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. //////////////////////// 2013-09-09 Marc Glisse Paolo Carlini PR c++/58362 * function.c (do_warn_unused_parameter): Use DECL_SOURCE_LOCATION. /testsuite 2013-09-09 Marc Glisse Paolo Carlini PR c++/58362 * c-c++-common/Wunused-parm-1.c: New. 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" } */