From patchwork Thu Mar 28 14:55:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 232056 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 71DA92C0040 for ; Fri, 29 Mar 2013 01:56:14 +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:references :in-reply-to:content-type; q=dns; s=default; b=B4TeWkxrKH/80suRK z9VCQYJZX+rWfSKiNUkcpuaMnUYpA0TOqJXpeZ5hI+11yzOdH8aXdGOwwZw1YmgX YDy/iLUkY2t0yXoA7P+lcm/hVO6FXa/IxP/O0Nj3WZ4CNV+fQAOXtErNOEBtORmL e3KCKf4SdrxEmOna4NgOyn7TkM= 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:references :in-reply-to:content-type; s=default; bh=Qrok0b4rhGwXAli2G5+bbWj K7Dc=; b=cQR4rsg3/LdLNcBhoGVuXhaoBsIFjyFg7K7b3AqWtgWdO/zTeyg0McD j1isiw/xLqIK327f4Btc7qbQ06FGIacmFeWxq/alyVO96vEgHD+5udBFo3e6tLn+ 8ciTtKlQxhq0muJY7tP3i1U8AGEO5I9EL7a/qnEy9E0nHo9WEE/w= Received: (qmail 27376 invoked by alias); 28 Mar 2013 14:55:56 -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 27356 invoked by uid 89); 28 Mar 2013 14:55:50 -0000 X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, TW_NV autolearn=ham version=3.3.1 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 14:55:46 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2SEtgth012857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Mar 2013 14:55:43 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2SEtfbJ021373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Mar 2013 14:55:41 GMT Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2SEte3Z027106; Thu, 28 Mar 2013 09:55:40 -0500 Received: from [192.168.1.4] (/79.52.192.230) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 28 Mar 2013 07:55:40 -0700 Message-ID: <515459EA.4080405@oracle.com> Date: Thu, 28 Mar 2013 15:55:38 +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: Re: [C++ Patch] PR 56725 References: <51544F38.9000902@oracle.com> In-Reply-To: <51544F38.9000902@oracle.com> X-Virus-Found: No .. oops, the patch I attached has a typo. This is the right one. Paolo. ////////////////////// Index: cp/call.c =================================================================== --- cp/call.c (revision 197198) +++ cp/call.c (working copy) @@ -5836,11 +5836,11 @@ convert_like_real (conversion *convs, tree expr, t break; } - permerror (loc, "invalid conversion from %qT to %qT", - TREE_TYPE (expr), totype); - if (fn) - permerror (DECL_SOURCE_LOCATION (fn), - " initializing argument %P of %qD", argnum, fn); + if (permerror (loc, "invalid conversion from %qT to %qT", + TREE_TYPE (expr), totype) + && fn) + inform (DECL_SOURCE_LOCATION (fn), + "initializing argument %P of %qD", argnum, fn); return cp_convert (totype, expr, complain); } @@ -5943,7 +5943,8 @@ convert_like_real (conversion *convs, tree expr, t build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL, complain); if (fn) - error (" initializing argument %P of %q+D", argnum, fn); + inform (input_location, "initializing argument %P of %q+D", + argnum, fn); } return error_mark_node; @@ -6074,7 +6075,8 @@ convert_like_real (conversion *convs, tree expr, t error_at (loc, "cannot bind %qT lvalue to %qT", TREE_TYPE (expr), totype); if (fn) - error (" initializing argument %P of %q+D", argnum, fn); + inform (input_location, + "initializing argument %P of %q+D", argnum, fn); return error_mark_node; } @@ -7467,11 +7469,11 @@ build_new_method_call_1 (tree instance, tree fns, if (! (complain & tf_error)) return error_mark_node; - permerror (input_location, - "cannot call constructor %<%T::%D%> directly", - basetype, name); - permerror (input_location, " for a function-style cast, remove the " - "redundant %<::%D%>", name); + if (permerror (input_location, + "cannot call constructor %<%T::%D%> directly", + basetype, name)) + inform (input_location, "for a function-style cast, remove the " + "redundant %<::%D%>", name); call = build_functional_cast (basetype, build_tree_list_vec (user_args), complain); return call; Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 197198) +++ cp/typeck.c (working copy) @@ -7984,13 +7984,12 @@ convert_for_initialization (tree exp, tree type, t if (fndecl) savew = warningcount + werrorcount, savee = errorcount; rhs = initialize_reference (type, rhs, flags, complain); - if (fndecl) - { - if (warningcount + werrorcount > savew) - warning (0, "in passing argument %P of %q+D", parmnum, fndecl); - else if (errorcount > savee) - error ("in passing argument %P of %q+D", parmnum, fndecl); - } + + if (fndecl + && (warningcount + werrorcount > savew || errorcount > savee)) + inform (input_location, + "in passing argument %P of %q+D", parmnum, fndecl); + return rhs; } Index: testsuite/g++.dg/conversion/op4.C =================================================================== --- testsuite/g++.dg/conversion/op4.C (revision 197198) +++ testsuite/g++.dg/conversion/op4.C (working copy) @@ -9,7 +9,7 @@ struct X { } }; -void add_one (X & ref) { /* { dg-error "in passing argument" } */ +void add_one (X & ref) { /* { dg-message "in passing argument" } */ ++ ref.x; } Index: testsuite/g++.dg/cpp0x/rv1n.C =================================================================== --- testsuite/g++.dg/cpp0x/rv1n.C (revision 197198) +++ testsuite/g++.dg/cpp0x/rv1n.C (working copy) @@ -30,7 +30,7 @@ const volatile A cv_source(); // 1 at a time -one sink_1_1( A&); // { dg-error "" } +one sink_1_1( A&); // { dg-message "" } int test1_1() { @@ -48,7 +48,7 @@ int test1_1() return 0; } -two sink_1_2(const A&); // { dg-error "" } +two sink_1_2(const A&); // { dg-message "" } int test1_2() { @@ -63,7 +63,7 @@ int test1_2() return 0; } -three sink_1_3(volatile A&); // { dg-error "" } +three sink_1_3(volatile A&); // { dg-message "" } int test1_3() { @@ -80,7 +80,7 @@ int test1_3() return 0; } -four sink_1_4(const volatile A&); // { dg-error "" } +four sink_1_4(const volatile A&); // { dg-message "" } int test1_4() { @@ -95,7 +95,7 @@ int test1_4() return 0; } -five sink_1_5( A&&); // { dg-error "" } +five sink_1_5( A&&); // { dg-message "" } int test1_5() { @@ -113,7 +113,7 @@ int test1_5() return 0; } -six sink_1_6(const A&&); // { dg-error "" } +six sink_1_6(const A&&); // { dg-message "" } int test1_6() { @@ -130,7 +130,7 @@ int test1_6() return 0; } -seven sink_1_7(volatile A&&); // { dg-error "" } +seven sink_1_7(volatile A&&); // { dg-message "" } int test1_7() { @@ -147,7 +147,7 @@ int test1_7() return 0; } -eight sink_1_8(const volatile A&&); // { dg-error "" } +eight sink_1_8(const volatile A&&); // { dg-message "" } int test1_8() { Index: testsuite/g++.dg/cpp0x/rv2n.C =================================================================== --- testsuite/g++.dg/cpp0x/rv2n.C (revision 197198) +++ testsuite/g++.dg/cpp0x/rv2n.C (working copy) @@ -161,7 +161,7 @@ int test2_17() } one sink_2_18( A&); -eight sink_2_18(const volatile A&&); // { dg-error "argument" } +eight sink_2_18(const volatile A&&); // { dg-message "argument" } int test2_18() { @@ -288,7 +288,7 @@ int test2_27() } two sink_2_28(const A&); -eight sink_2_28(const volatile A&&); // { dg-error "argument" } +eight sink_2_28(const volatile A&&); // { dg-message "argument" } int test2_28() { @@ -362,7 +362,7 @@ int test2_37() } three sink_2_38(volatile A&); -eight sink_2_38(const volatile A&&); // { dg-error "argument" } +eight sink_2_38(const volatile A&&); // { dg-message "argument" } int test2_38() { @@ -468,8 +468,8 @@ int test2_57() return 0; } -five sink_2_58( A&&); // { dg-error "argument" } -eight sink_2_58(const volatile A&&); // { dg-error "argument" } +five sink_2_58( A&&); // { dg-message "argument" } +eight sink_2_58(const volatile A&&); // { dg-message "argument" } int test2_58() { @@ -505,8 +505,8 @@ int test2_67() return 0; } -six sink_2_68(const A&&); // { dg-error "argument" } -eight sink_2_68(const volatile A&&); // { dg-error "argument" } +six sink_2_68(const A&&); // { dg-message "argument" } +eight sink_2_68(const volatile A&&); // { dg-message "argument" } int test2_68() { @@ -520,8 +520,8 @@ int test2_68() sink_2_68(cva); // { dg-error "lvalue" } } -seven sink_2_78(volatile A&&); // { dg-error "argument" } -eight sink_2_78(const volatile A&&); // { dg-error "argument" } +seven sink_2_78(volatile A&&); // { dg-message "argument" } +eight sink_2_78(const volatile A&&); // { dg-message "argument" } int test2_78() { Index: testsuite/g++.dg/cpp0x/template_deduction.C =================================================================== --- testsuite/g++.dg/cpp0x/template_deduction.C (revision 197198) +++ testsuite/g++.dg/cpp0x/template_deduction.C (working copy) @@ -35,7 +35,7 @@ test1(T&&) template void -test2(const T&&) // { dg-error "argument" } +test2(const T&&) // { dg-message "argument" } { sa::value == is_lvalue_ref> t1; sa::value == is_rvalue_ref> t2; Index: testsuite/g++.dg/expr/cond8.C =================================================================== --- testsuite/g++.dg/expr/cond8.C (revision 197198) +++ testsuite/g++.dg/expr/cond8.C (working copy) @@ -3,7 +3,7 @@ struct A { - A(void*); // { dg-error "initializing" } + A(void*); // { dg-message "initializing" } ~A(); }; Index: testsuite/g++.dg/other/error4.C =================================================================== --- testsuite/g++.dg/other/error4.C (revision 197198) +++ testsuite/g++.dg/other/error4.C (working copy) @@ -7,7 +7,7 @@ struct Wrapper {}; -void Foo(int const &); // { dg-error "in passing" "" } +void Foo(int const &); // { dg-message "in passing" "" } void Baz () { Index: testsuite/g++.old-deja/g++.bugs/900514_03.C =================================================================== --- testsuite/g++.old-deja/g++.bugs/900514_03.C (revision 197198) +++ testsuite/g++.old-deja/g++.bugs/900514_03.C (working copy) @@ -16,7 +16,7 @@ struct t_0_st_0; -struct t_0_st_1 { // { dg-error "initializing" } +struct t_0_st_1 { // { dg-message "initializing" } int member; t_0_st_1 (t_0_st_0&);// { dg-message "note" } @@ -85,7 +85,7 @@ void t_1_local_init () struct t_2_st_0; -struct t_2_st_1 { // { dg-error "initializing" } +struct t_2_st_1 { // { dg-message "initializing" } int member; t_2_st_1 (t_2_st_0); // { dg-message "note" } Index: testsuite/g++.old-deja/g++.bugs/900519_02.C =================================================================== --- testsuite/g++.old-deja/g++.bugs/900519_02.C (revision 197198) +++ testsuite/g++.old-deja/g++.bugs/900519_02.C (working copy) @@ -10,7 +10,7 @@ extern const int cint_obj = 9; volatile int vint_obj = 9; -void take_int_ref (int& arg) { } // { dg-error "" } referenced by errors below +void take_int_ref (int& arg) { } // { dg-message "" } referenced by errors below int& global_int_ref0 = cint_obj; // { dg-error "" } int& global_int_ref1 = vint_obj; // { dg-error "" } Index: testsuite/g++.old-deja/g++.bugs/900519_03.C =================================================================== --- testsuite/g++.old-deja/g++.bugs/900519_03.C (revision 197198) +++ testsuite/g++.old-deja/g++.bugs/900519_03.C (working copy) @@ -14,8 +14,8 @@ extern const int cint_obj; extern volatile int vint_obj; -void take_cint_ref (const int& arg) { } // { dg-error "" } -void take_vint_ref (volatile int& arg) { } // { dg-error "" } +void take_cint_ref (const int& arg) { } // { dg-message "" } +void take_vint_ref (volatile int& arg) { } // { dg-message "" } const int& global_cint_ref2 = vint_obj; // { dg-error "" } Index: testsuite/g++.old-deja/g++.bugs/900520_02.C =================================================================== --- testsuite/g++.old-deja/g++.bugs/900520_02.C (revision 197198) +++ testsuite/g++.old-deja/g++.bugs/900520_02.C (working copy) @@ -9,7 +9,7 @@ typedef int u_array[]; typedef b_array &b_array_ref; typedef u_array &u_array_ref; -void take_b_array_ref (b_array_ref arg) { } // { dg-error "" } passed to here +void take_b_array_ref (b_array_ref arg) { } // { dg-message "" } passed to here extern u_array u_array_gbl_obj; Index: testsuite/g++.old-deja/g++.jason/conversion2.C =================================================================== --- testsuite/g++.old-deja/g++.jason/conversion2.C (revision 197198) +++ testsuite/g++.old-deja/g++.jason/conversion2.C (working copy) @@ -1,7 +1,7 @@ // { dg-do assemble } // PRMS Id: 3069 -void f(int&); // { dg-error "" } referenced by error below +void f(int&); // { dg-message "" } referenced by error below void g(const int& i) { f(i); // { dg-error "" } discarding const } Index: testsuite/g++.old-deja/g++.law/cvt20.C =================================================================== --- testsuite/g++.old-deja/g++.law/cvt20.C (revision 197198) +++ testsuite/g++.old-deja/g++.law/cvt20.C (working copy) @@ -9,7 +9,7 @@ // Compiles fine with Sun CC 2.1 -void f(char *& x) // { dg-error "passing argument" } +void f(char *& x) // { dg-message "passing argument" } { x++; } Index: testsuite/g++.old-deja/g++.law/cvt8.C =================================================================== --- testsuite/g++.old-deja/g++.law/cvt8.C (revision 197198) +++ testsuite/g++.old-deja/g++.law/cvt8.C (working copy) @@ -24,7 +24,7 @@ B::operator const A&() const { return a; } -void f(A &a) { // { dg-error "" } in passing argument +void f(A &a) { // { dg-message "" } in passing argument printf("A at %x is %d\n", &a, a.i); } Index: testsuite/g++.old-deja/g++.law/init8.C =================================================================== --- testsuite/g++.old-deja/g++.law/init8.C (revision 197198) +++ testsuite/g++.old-deja/g++.law/init8.C (working copy) @@ -8,7 +8,7 @@ const int ic = 1; -void f(int& arg) // { dg-error "passing argument 1" } +void f(int& arg) // { dg-message "passing argument 1" } { if (arg) ; } Index: testsuite/g++.old-deja/g++.mike/net12.C =================================================================== --- testsuite/g++.old-deja/g++.mike/net12.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/net12.C (working copy) @@ -7,7 +7,7 @@ struct Foo { void m() const; }; -void other(char &x); // { dg-error "" } reference below +void other(char &x); // { dg-message "" } reference below void Foo::m() const Index: testsuite/g++.old-deja/g++.mike/net8.C =================================================================== --- testsuite/g++.old-deja/g++.mike/net8.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/net8.C (working copy) @@ -11,14 +11,14 @@ class Derived : public Base { int bar; }; -void func(Base&); // { dg-error "passing argument 1" } +void func(Base&); // { dg-message "passing argument 1" } void func2(const Derived& d) { func(d); // { dg-error "invalid initialization" } } void -foo (int& a) // { dg-error "in passing argument 1" } +foo (int& a) // { dg-message "in passing argument 1" } { } Index: testsuite/g++.old-deja/g++.mike/p2793.C =================================================================== --- testsuite/g++.old-deja/g++.mike/p2793.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/p2793.C (working copy) @@ -1,6 +1,6 @@ // { dg-do assemble } // prms-id: 2793 -void f(char&) { // { dg-error "" } referenced by error below +void f(char&) { // { dg-message "" } referenced by error below f('c'); // { dg-error "" } } Index: testsuite/g++.old-deja/g++.mike/p3836.C =================================================================== --- testsuite/g++.old-deja/g++.mike/p3836.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/p3836.C (working copy) @@ -1,7 +1,7 @@ // { dg-do assemble } // prms-id: 3836 -void f(int &i) { // { dg-error "" } ref line +void f(int &i) { // { dg-message "" } ref line i = 10; } Index: testsuite/g++.old-deja/g++.mike/p418.C =================================================================== --- testsuite/g++.old-deja/g++.mike/p418.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/p418.C (working copy) @@ -11,7 +11,7 @@ class Derived : public Base { int bar; }; -void func(Base&); // { dg-error "" } referenced by error below +void func(Base&); // { dg-message "" } referenced by error below void func2(const Derived& d) { func(d); // { dg-error "" } should be error because of const Index: testsuite/g++.old-deja/g++.mike/p701.C =================================================================== --- testsuite/g++.old-deja/g++.mike/p701.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/p701.C (working copy) @@ -7,7 +7,7 @@ extern "C" } -void Munge(int& x) // { dg-error "passing argument 1" } +void Munge(int& x) // { dg-message "passing argument 1" } { x = 2; } Index: testsuite/g++.old-deja/g++.mike/p807.C =================================================================== --- testsuite/g++.old-deja/g++.mike/p807.C (revision 197198) +++ testsuite/g++.old-deja/g++.mike/p807.C (working copy) @@ -24,7 +24,7 @@ class B }; -int foo(B& b); // { dg-error "" } referenced below +int foo(B& b); // { dg-message "" } referenced below int main()