From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5805 invoked by alias); 11 Jun 2010 09:55:36 -0000 Received: (qmail 5795 invoked by uid 22791); 11 Jun 2010 09:55:35 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_FN,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from rcsinet10.oracle.com (HELO rcsinet10.oracle.com) (148.87.113.121) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Jun 2010 09:55:31 +0000 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5B9tP8x022960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Jun 2010 09:55:26 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5B9tO4C007549; Fri, 11 Jun 2010 09:55:24 GMT Received: from abhmt004.oracle.com by acsmt355.oracle.com with ESMTP id 316867181276250041; Fri, 11 Jun 2010 02:54:01 -0700 Received: from dhcp-beijing-cdc-10-182-121-28.cn.oracle.com (/10.182.121.28) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 11 Jun 2010 02:54:01 -0700 Message-ID: <4C1207C8.2070101@oracle.com> Date: Fri, 11 Jun 2010 10:50:00 -0000 From: Shujing Zhao User-Agent: Thunderbird 2.0.0.24 (X11/20100228) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Manuel_L=F3pez-Ib=E1=F1ez?= CC: Jason Merrill , Joseph , Gcc-Patches , Paolo Carlini Subject: Re: [PATCH C/C++] Fix some diagnostics problems References: <4C0DC2B4.3080200@oracle.com> <4C0E94C8.4070807@redhat.com> <4C0F4D3A.6010207@oracle.com> <4C0F8F5B.9000208@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2010-06/txt/msg01193.txt.bz2 On 06/11/2010 05:17 PM, Manuel López-Ibáñez wrote: > On 9 June 2010 14:55, Jason Merrill wrote: >> On 06/09/2010 04:13 AM, Shujing Zhao wrote: >>> On 06/09/2010 03:06 AM, Jason Merrill wrote: >>>>> + case ICR_DEFAULT_ARGUMENT: >>>>> + error ("cannot convert %qT to %qT in default argument", >>>>> + rhstype, type); >>>>> + case ICR_ARGPASS: >>>>> + error ("cannot convert %qT to %qT in argument passing", >>>>> + rhstype, type); >>>>> + break; >>>> These cases are unreachable, as they are covered by the previous if >>>> (fndecl) test. Either remove the if (fndecl) message and use >>>> parmnum/fndecl in these cases, or just use gcc_unreachable() in these >>>> cases. >>> At the test case testsuite/g++.old-deja/g++.mike/p10769b.C, the 'fndecl' >>> is NULL, while the errtype is ICR_ARGPASS (argument passing). >> Ah, of course, when you're calling a function pointer you don't have a >> declaration. Is parmnum still set? > > Why not document that in the function comment? I would say that the comment > > /* If FNDECL is non-NULL, we > are doing the conversion in order to pass the PARMNUMth argument of > FNDECL. */ > > is wrong. > > In any case, I don't understand why we cannot pass down the name of > the pointer for diagnostics purposes since fndecl does not determine > anymore whether is a argument conversion. > I agree with your last comment to use %qP for parmnum. About this issue, I think the comment is not wrong when FNDECL is non-NULL. How about to add the case when FNDECL is NULL? just as the following: /* If FNDECL is non-NULL, we are doing the conversion in order to pass the PARMNUMth argument of FNDECL. If FNDECL is NULL, we are doing the conversion in function pointer argument passing, conversion in initialization, etc. */ If you agree with it, I'll submit the patch. Thanks Pearly