From patchwork Thu Mar 28 01:09:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 231862 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id ED0002C0089 for ; Thu, 28 Mar 2013 12:10:20 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=Mm98Ixl5e3mIwnzfj35txGUEvwKAKgNXol7H6araZou yqg4vbYSlazfFIH4nojQ61NTDn6lCO+V8dKJQaeBNmFc7rV8vAcx97BHKfCsqQ1b GwzjToj6VCxF7DsmkSajwqGKY70WN3ZkKhp+GAEdPVQarV5WkuhzKbpSiXkLV9TU = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=G4vM8gVnJzHfMSJXfafUvnjy1W4=; b=iauPAxe0sYx9Fdkjo +0MfmBWCaZVe9TwqtGTvG7ZZbEq6y7G7NFIfsIRqv2aVozohom7TIWMZPeOSU2NR 9gVRH2FGPSNFb8/9fUsRGFF1Bk7KyojdyFsUDgjC9osD8YioJ2pre5n3VCxFYtCc uonZWWNDGd4iQjHROJNWwqhprw= Received: (qmail 30583 invoked by alias); 28 Mar 2013 01:10:03 -0000 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 Received: (qmail 30404 invoked by uid 89); 28 Mar 2013 01:09:56 -0000 X-Spam-SWARE-Status: No, score=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 01:09:53 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2S19o7q017844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Mar 2013 01:09:51 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2S19nQZ021736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Mar 2013 01:09:50 GMT Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2S19n7O013222; Wed, 27 Mar 2013 20:09:49 -0500 Received: from [192.168.1.4] (/79.52.192.230) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Mar 2013 18:09:49 -0700 Message-ID: <5153985B.4040105@oracle.com> Date: Thu, 28 Mar 2013 02:09:47 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] Fix some informs following permerror X-Virus-Found: No Hi, this is almost obvious, I guess: Manuel kindly explained in the audit trail of c++/56725 that if a permerror returns false no diagnostic was actually emitted thus any accompanying inform should not be called, otherwise with -fpermissive -w only the latter are wrongly emitted. Tested x86_64-linux. Thanks, Paolo. /////////////////////// 2013-03-27 Paolo Carlini * call.c (joust): Don't call inform for a permerror returning false. * parser.c (cp_parser_check_class_key): Likewise. * pt.c (tsubst_copy_and_build): Likewise. Index: call.c =================================================================== --- call.c (revision 197184) +++ call.c (working copy) @@ -8650,13 +8650,15 @@ joust (struct z_candidate *cand1, struct z_candida { if (complain & tf_error) { - permerror (input_location, - "default argument mismatch in " - "overload resolution"); - inform (input_location, - " candidate 1: %q+#F", cand1->fn); - inform (input_location, - " candidate 2: %q+#F", cand2->fn); + if (permerror (input_location, + "default argument mismatch in " + "overload resolution")) + { + inform (input_location, + " candidate 1: %q+#F", cand1->fn); + inform (input_location, + " candidate 2: %q+#F", cand2->fn); + } } else return 0; Index: parser.c =================================================================== --- parser.c (revision 197184) +++ parser.c (working copy) @@ -23363,12 +23363,12 @@ cp_parser_check_class_key (enum tag_types class_ke return; if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type)) { - permerror (input_location, "%qs tag used in naming %q#T", - class_key == union_type ? "union" - : class_key == record_type ? "struct" : "class", - type); - inform (DECL_SOURCE_LOCATION (TYPE_NAME (type)), - "%q#T was previously declared here", type); + if (permerror (input_location, "%qs tag used in naming %q#T", + class_key == union_type ? "union" + : class_key == record_type ? "struct" : "class", + type)) + inform (DECL_SOURCE_LOCATION (TYPE_NAME (type)), + "%q#T was previously declared here", type); } } Index: pt.c =================================================================== --- pt.c (revision 197184) +++ pt.c (working copy) @@ -14019,30 +14019,32 @@ tsubst_copy_and_build (tree t, fn = TREE_OPERAND (fn, 1); if (is_overloaded_fn (fn)) fn = get_first_fn (fn); - permerror (EXPR_LOC_OR_HERE (t), - "%qD was not declared in this scope, " - "and no declarations were found by " - "argument-dependent lookup at the point " - "of instantiation", function); - if (!DECL_P (fn)) - /* Can't say anything more. */; - else if (DECL_CLASS_SCOPE_P (fn)) + if (permerror (EXPR_LOC_OR_HERE (t), + "%qD was not declared in this scope, " + "and no declarations were found by " + "argument-dependent lookup at the point " + "of instantiation", function)) { - inform (EXPR_LOC_OR_HERE (t), - "declarations in dependent base %qT are " - "not found by unqualified lookup", - DECL_CLASS_CONTEXT (fn)); - if (current_class_ptr) - inform (EXPR_LOC_OR_HERE (t), - "use %%D%> instead", function); + if (!DECL_P (fn)) + /* Can't say anything more. */; + else if (DECL_CLASS_SCOPE_P (fn)) + { + inform (EXPR_LOC_OR_HERE (t), + "declarations in dependent base %qT are " + "not found by unqualified lookup", + DECL_CLASS_CONTEXT (fn)); + if (current_class_ptr) + inform (EXPR_LOC_OR_HERE (t), + "use %%D%> instead", function); + else + inform (EXPR_LOC_OR_HERE (t), + "use %<%T::%D%> instead", + current_class_name, function); + } else - inform (EXPR_LOC_OR_HERE (t), - "use %<%T::%D%> instead", - current_class_name, function); + inform (0, "%q+D declared here, later in the " + "translation unit", fn); } - else - inform (0, "%q+D declared here, later in the " - "translation unit", fn); function = unq; } }