From patchwork Sat Jun 12 06:54:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shujing Zhao X-Patchwork-Id: 55380 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]) by ozlabs.org (Postfix) with SMTP id 2DDD0B7D4F for ; Sat, 12 Jun 2010 16:54:48 +1000 (EST) Received: (qmail 9046 invoked by alias); 12 Jun 2010 06:54:46 -0000 Received: (qmail 9032 invoked by uid 22791); 12 Jun 2010 06:54:45 -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; Sat, 12 Jun 2010 06:54:40 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5C6samZ008375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 12 Jun 2010 06:54:37 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5C6sXWl010469; Sat, 12 Jun 2010 06:54:33 GMT Received: from abhmt006.oracle.com by acsmt353.oracle.com with ESMTP id 319487611276325650; Fri, 11 Jun 2010 23:54:10 -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 23:54:10 -0700 Message-ID: <4C132F20.80901@oracle.com> Date: Sat, 12 Jun 2010 14:54:24 +0800 From: Shujing Zhao User-Agent: Thunderbird 2.0.0.24 (X11/20100228) MIME-Version: 1.0 To: Jason Merrill CC: =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= , 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> <4C1207C8.2070101@oracle.com> In-Reply-To: X-IsSubscribed: yes 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 On 06/11/2010 06:03 PM, Manuel López-Ibáñez wrote: > On 11 June 2010 11:54, Shujing Zhao wrote: >> 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. > > In that function, fndecl is only used for providing better > diagnostics. Right now, the diagnostic is less informative when using > a pointer than when not. I think it should be equally informative. > That said, your proposal is better than nothing of course. > > Manuel. Jason, This patch is to use %qP for parnum and fix the comment of convert_for_assignment and convert_for_initialization. Retested on 1686-pc-linux-gnu. Is it ok? Thanks Pearly 2010-06-12 Shujing Zhao * typeck.c (convert_for_assignment): Fix comment. Change message format from %d to %qP. (convert_for_initialization): Fix comment. Index: typeck.c =================================================================== --- typeck.c (revision 160644) +++ typeck.c (working copy) @@ -7186,10 +7186,11 @@ delta_from_ptrmemfunc (tree t) } /* Convert value RHS to type TYPE as preparation for an assignment to - an lvalue of type TYPE. ERRTYPE is a string to use in error - messages: "assignment", "return", etc. If FNDECL is non-NULL, we - are doing the conversion in order to pass the PARMNUMth argument of - FNDECL. */ + an lvalue of type TYPE. ERRTYPE indicates what kind of error the + implicit conversion is. 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. */ static tree convert_for_assignment (tree type, tree rhs, @@ -7331,7 +7332,7 @@ convert_for_assignment (tree type, tree case ICR_DEFAULT_ARGUMENT: if (fndecl) warning (OPT_Wmissing_format_attribute, - "parameter %d of %qD might be a candidate " + "parameter %qP of %qD might be a candidate " "for a format attribute", parmnum, fndecl); else warning (OPT_Wmissing_format_attribute, @@ -7386,7 +7387,7 @@ convert_for_assignment (tree type, tree /* Convert RHS to be of type TYPE. If EXP is nonzero, it is the target of the initialization. - ERRTYPE is a string to use in error messages. + ERRTYPE indicates what kind of error the implicit conversion is. Two major differences between the behavior of `convert_for_assignment' and `convert_for_initialization'