From patchwork Tue Oct 11 00:10:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 118850 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 0E6D3B70C3 for ; Tue, 11 Oct 2011 11:12:28 +1100 (EST) Received: (qmail 13814 invoked by alias); 11 Oct 2011 00:12:18 -0000 Received: (qmail 13797 invoked by uid 22791); 11 Oct 2011 00:12:13 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Oct 2011 00:11:59 +0000 Received: from ucsinet23.oracle.com (ucsinet23.oracle.com [156.151.31.71]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9B0Bvge007379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 11 Oct 2011 00:11:58 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet23.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9B0BuY1029877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Oct 2011 00:11:56 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9B0BoUV018160; Mon, 10 Oct 2011 19:11:51 -0500 Received: from [192.168.1.4] (/79.53.14.153) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Oct 2011 17:11:49 -0700 Message-ID: <4E93896A.9090105@oracle.com> Date: Tue, 11 Oct 2011 02:10:18 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 50660 References: <4E918FED.4060002@oracle.com> <4E9222CC.2080906@redhat.com> <4E92232A.6080607@redhat.com> <4E9231CA.9060006@oracle.com> <4E9383CC.8070300@redhat.com> In-Reply-To: <4E9383CC.8070300@redhat.com> 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 10/11/2011 01:46 AM, Jason Merrill wrote: > On 10/10/2011 12:44 AM, Paolo Carlini wrote: >> If I just do this (I hope it's what you had in mind): >> >> - tree t = non_reference (totype); >> + tree t = totype; /*non_reference (totype); */ >> >> variadic111.C:16:22: warning: converting ‘false’ to pointer type for >> argument 3 of ‘void S::f(Args1 ..., Args2&& ...) [with Args2 = >> {bool, char}; Args1 = {int, double}]’ [-Wconversion-null] > Hmm, need to also change POINTER_TYPE_P to TYPE_PTR_P. Great, this works (and I even learned something ;) Shall I commit it when testing finishes? Thanks, Paolo. /////////////////// 2011-10-10 Paolo Carlini PR c++/50660 * call.c (conversion_null_warnings): Don't look through references. Index: call.c =================================================================== --- call.c (revision 179765) +++ call.c (working copy) @@ -5514,10 +5514,9 @@ static void conversion_null_warnings (tree totype, tree expr, tree fn, int argnum) { - tree t = non_reference (totype); - /* Issue warnings about peculiar, but valid, uses of NULL. */ - if (expr == null_node && TREE_CODE (t) != BOOLEAN_TYPE && ARITHMETIC_TYPE_P (t)) + if (expr == null_node && TREE_CODE (totype) != BOOLEAN_TYPE + && ARITHMETIC_TYPE_P (totype)) { if (fn) warning_at (input_location, OPT_Wconversion_null, @@ -5525,11 +5524,11 @@ argnum, fn); else warning_at (input_location, OPT_Wconversion_null, - "converting to non-pointer type %qT from NULL", t); + "converting to non-pointer type %qT from NULL", totype); } /* Issue warnings if "false" is converted to a NULL pointer */ - else if (expr == boolean_false_node && POINTER_TYPE_P (t)) + else if (expr == boolean_false_node && TYPE_PTR_P (totype)) { if (fn) warning_at (input_location, OPT_Wconversion_null, @@ -5537,7 +5536,7 @@ "of %qD", argnum, fn); else warning_at (input_location, OPT_Wconversion_null, - "converting % to pointer type %qT", t); + "converting % to pointer type %qT", totype); } }