From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28897 invoked by alias); 9 Sep 2013 09:43:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28888 invoked by uid 89); 9 Sep 2013 09:43:17 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Sep 2013 09:43:17 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r899hF8a010542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 Sep 2013 05:43:15 -0400 Received: from tucnak.zalov.cz (vpn1-4-75.ams2.redhat.com [10.36.4.75]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r899hDxG026300 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Sep 2013 05:43:14 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id r899hCjY018434; Mon, 9 Sep 2013 11:43:12 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id r899hBl0018433; Mon, 9 Sep 2013 11:43:11 +0200 Date: Mon, 09 Sep 2013 09:45:00 -0000 From: Jakub Jelinek To: Richard Biener Cc: Paolo Carlini , "gcc-patches@gcc.gnu.org" , Jan Hubicka Subject: Re: [Patch to gcc/function] PR 58362 Message-ID: <20130909094311.GG1817@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <522CCF1B.8080007@oracle.com> <522D8BBC.608@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00580.txt.bz2 On Mon, Sep 09, 2013 at 11:37:31AM +0200, Richard Biener wrote: > > > > > 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. > > > > I would have expected %q+D to use the location of the corresponding > > > > decl, not some random other location. So, isn't the bug in the > > > > C++ frontend diagnostic machinery? > > > Well, first notice that the patch fixes the issue *both* for the C and C++ > > > front-ends, that's why I added the testcase to c-c++-common. This isn't a C++ > > > issue. Then notice that we do already have tens of cases where we use > > > DECL_SOURCE_LOCATION + %qD, when we want to be precise about the location. The > > > diagnostic machinery has this mechanism using + which uses location_of, which > > > is often useful for expressions, but which very often we don't use for decls. > > > In fact, some people, like Manuel, see the audit trail of the bug, find the > > > mechanism quite confusing. Is there something specific you want me to check? > > > > How is '+' in %q+D defined? I failed to find documentation of the > > diagnostic formats (but only searched for like two minutes). > > That said, grepping for %q+D reveals quite some uses and it looks like > all of them expect the location being used to be that of the decl passed > to the diagnostic call, not some random other location. The C++ FE locus handling is in very bad shape (C FE is much better, Aldy and others have spent quite some time fixing all the issues). I guess this is just one of the many issues. The most annoying to me is that the C++ FE for function calls uses the location of the closing ) of the call expression rather than the function name or at least opening (, so if you have a call_something (one_arg, second_arg, third_arg, fourth_arg, fifth_arg); you really don't see what is being called in the debugger when debugging C++. Jakub