From patchwork Fri Oct 7 23:56:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 118398 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 B8F64B71A4 for ; Sat, 8 Oct 2011 10:58:19 +1100 (EST) Received: (qmail 30525 invoked by alias); 7 Oct 2011 23:58:16 -0000 Received: (qmail 30517 invoked by uid 22791); 7 Oct 2011 23:58:15 -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 acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Oct 2011 23:57:58 +0000 Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p97Nvtls003095 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Oct 2011 23:57:57 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p97NvsZH014739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Oct 2011 23:57:55 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p97NvnAg007080; Fri, 7 Oct 2011 18:57:49 -0500 Received: from [192.168.1.4] (/79.25.196.4) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 07 Oct 2011 16:57:48 -0700 Message-ID: <4E8F91A0.2030600@oracle.com> Date: Sat, 08 Oct 2011 01:56:16 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110922 Thunderbird/7.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 34927 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 Hi, this diagnostic PR is about duplicate inform messages for this kind of testcase, where C has a cloned destructor: class A {}; struct C : A { virtual ~C () = 0; } c; The fix seems easy: output a cloned destructor only once (+ output any other member functions normally). Patch tested x86_64-linux for regressions. Ok? Thanks, Paolo. /////////////////////// 2011-10-07 Paolo Carlini PR c++/34927 * typeck2.c (abstract_virtuals_error_sfinae): Don't produce duplicate inform messages in case of cloned destructor. Index: typeck2.c =================================================================== --- typeck2.c (revision 179660) +++ typeck2.c (working copy) @@ -340,7 +340,17 @@ abstract_virtuals_error_sfinae (tree decl, tree ty type); FOR_EACH_VEC_ELT (tree, pure, ix, fn) - inform (input_location, "\t%+#D", fn); + { + static bool done_cloned_dest = false; + + bool is_cloned_dest = DECL_CLONED_FUNCTION_P (fn); + if (! is_cloned_dest || ! done_cloned_dest) + inform (input_location, "\t%+#D", fn); + + if (is_cloned_dest) + done_cloned_dest = true; + } + /* Now truncate the vector. This leaves it non-null, so we know there are pure virtuals, but empty so we don't list them out again. */