diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2013-03-28 16:03:32 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-03-28 16:03:32 +0000 |
commit | 7abebba7f231dee68ab5a16f50a3f1b182b5a5cc (patch) | |
tree | 1e29e643bd0eae0c6a366fe4ce13190c450e7785 /gcc | |
parent | 89ab31c15784b9d163e15688cc7c5bd589bcf465 (diff) | |
download | gcc-7abebba7f231dee68ab5a16f50a3f1b182b5a5cc.zip gcc-7abebba7f231dee68ab5a16f50a3f1b182b5a5cc.tar.gz gcc-7abebba7f231dee68ab5a16f50a3f1b182b5a5cc.tar.bz2 |
re PR c++/56725 (extra spaces in error message)
/cp
2013-03-28 Paolo Carlini <paolo.carlini@oracle.com>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/56725
* call.c (convert_like_real): Change series of two permerrors
to permerror + inform (and likewise for two errors).
(build_new_method_call_1): Likewise.
* typeck.c (convert_for_initialization): Change additional
warning or error to inform.
/testsuite
2013-03-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56725
* g++.dg/conversion/op4.C: Adjust.
* g++.dg/cpp0x/rv1n.C: Likewise.
* g++.dg/cpp0x/rv2n.C: Likewise.
* g++.dg/cpp0x/template_deduction.C: Likewise.
* g++.dg/expr/cond8.C: Likewise.
* g++.dg/other/error4.C: Likewise.
* g++.old-deja/g++.bugs/900514_03.C: Likewise.
* g++.old-deja/g++.bugs/900519_02.C: Likewise.
* g++.old-deja/g++.bugs/900519_03.C: Likewise.
* g++.old-deja/g++.bugs/900520_02.C: Likewise.
* g++.old-deja/g++.jason/conversion2.C: Likewise.
* g++.old-deja/g++.law/cvt20.C: Likewise.
* g++.old-deja/g++.law/cvt8.C: Likewise.
* g++.old-deja/g++.law/init8.C: Likewise.
* g++.old-deja/g++.mike/net12.C: Likewise.
* g++.old-deja/g++.mike/net8.C: Likewise.
* g++.old-deja/g++.mike/p2793.C: Likewise.
* g++.old-deja/g++.mike/p3836.C: Likewise.
* g++.old-deja/g++.mike/p418.C: Likewise.
* g++.old-deja/g++.mike/p701.C: Likewise.
* g++.old-deja/g++.mike/p807.C: Likewise.
From-SVN: r197206
Diffstat (limited to 'gcc')
25 files changed, 95 insertions, 59 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f4952838..ecc5503 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2013-03-28 Paolo Carlini <paolo.carlini@oracle.com> + Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c++/56725 + * call.c (convert_like_real): Change series of two permerrors + to permerror + inform (and likewise for two errors). + (build_new_method_call_1): Likewise. + * typeck.c (convert_for_initialization): Change additional + warning or error to inform. + 2013-03-28 Gabriel Dos Reis <gdr@integrable-solutions.net> * cp-tree.h (next_aggr_init_expr_arg): Remove static specifier. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index cff653f..d39124d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5836,11 +5836,11 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, 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, tree fn, int argnum, 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, tree fn, int argnum, 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, vec<tree, va_gc> **args, 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; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index a0caa30..4b6468c 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -7984,13 +7984,12 @@ convert_for_initialization (tree exp, tree type, tree rhs, int flags, 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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad135a6..c5f0c27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,32 @@ +2013-03-28 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/56725 + * g++.dg/conversion/op4.C: Adjust. + * g++.dg/cpp0x/rv1n.C: Likewise. + * g++.dg/cpp0x/rv2n.C: Likewise. + * g++.dg/cpp0x/template_deduction.C: Likewise. + * g++.dg/expr/cond8.C: Likewise. + * g++.dg/other/error4.C: Likewise. + * g++.old-deja/g++.bugs/900514_03.C: Likewise. + * g++.old-deja/g++.bugs/900519_02.C: Likewise. + * g++.old-deja/g++.bugs/900519_03.C: Likewise. + * g++.old-deja/g++.bugs/900520_02.C: Likewise. + * g++.old-deja/g++.jason/conversion2.C: Likewise. + * g++.old-deja/g++.law/cvt20.C: Likewise. + * g++.old-deja/g++.law/cvt8.C: Likewise. + * g++.old-deja/g++.law/init8.C: Likewise. + * g++.old-deja/g++.mike/net12.C: Likewise. + * g++.old-deja/g++.mike/net8.C: Likewise. + * g++.old-deja/g++.mike/p2793.C: Likewise. + * g++.old-deja/g++.mike/p3836.C: Likewise. + * g++.old-deja/g++.mike/p418.C: Likewise. + * g++.old-deja/g++.mike/p701.C: Likewise. + * g++.old-deja/g++.mike/p807.C: Likewise. + 2013-03-28 Tejas Belagod <tejas.belagod@arm.com> PR middle-end/56694 - * g++.dg/torture/pr56694.C: Fix test case to build on bare-metal + * g++.dg/torture/pr56694.C: Fix test case to build on bare-metal targets. 2013-03-28 Marek Polacek <polacek@redhat.com> diff --git a/gcc/testsuite/g++.dg/conversion/op4.C b/gcc/testsuite/g++.dg/conversion/op4.C index 5f8214b..7ef4b6a 100644 --- a/gcc/testsuite/g++.dg/conversion/op4.C +++ b/gcc/testsuite/g++.dg/conversion/op4.C @@ -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; } diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1n.C b/gcc/testsuite/g++.dg/cpp0x/rv1n.C index 68305eb..b15bdfb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv1n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv1n.C @@ -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() { diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C index a9d3741..f22e863 100644 --- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C +++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C @@ -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() { diff --git a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C index c1eace6..4b8bd12 100644 --- a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C +++ b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C @@ -35,7 +35,7 @@ test1(T&&) template <bool is_lvalue_ref, bool is_rvalue_ref, class T> void -test2(const T&&) // { dg-error "argument" } +test2(const T&&) // { dg-message "argument" } { sa<is_lvalue_reference<const T&&>::value == is_lvalue_ref> t1; sa<is_rvalue_reference<const T&&>::value == is_rvalue_ref> t2; diff --git a/gcc/testsuite/g++.dg/expr/cond8.C b/gcc/testsuite/g++.dg/expr/cond8.C index 11708ec..3e08953 100644 --- a/gcc/testsuite/g++.dg/expr/cond8.C +++ b/gcc/testsuite/g++.dg/expr/cond8.C @@ -3,7 +3,7 @@ struct A { - A(void*); // { dg-error "initializing" } + A(void*); // { dg-message "initializing" } ~A(); }; diff --git a/gcc/testsuite/g++.dg/other/error4.C b/gcc/testsuite/g++.dg/other/error4.C index bd740d9..a5d5e3c7 100644 --- a/gcc/testsuite/g++.dg/other/error4.C +++ b/gcc/testsuite/g++.dg/other/error4.C @@ -7,7 +7,7 @@ struct Wrapper {}; -void Foo(int const &); // { dg-error "in passing" "" } +void Foo(int const &); // { dg-message "in passing" "" } void Baz () { diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C index 30c2603..e2460d9 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900514_03.C @@ -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" } diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900519_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900519_02.C index 831c4a7..309d1ed 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900519_02.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900519_02.C @@ -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 "" } diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900519_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900519_03.C index b840ee7..8f845f4 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900519_03.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900519_03.C @@ -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 "" } diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C b/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C index 0c8d8a2..69e0440 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900520_02.C @@ -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; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C b/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C index ebc2bd1..f10df71 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/conversion2.C @@ -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 } diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C index 5d699d7..9389a10 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt20.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt20.C @@ -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++; } diff --git a/gcc/testsuite/g++.old-deja/g++.law/cvt8.C b/gcc/testsuite/g++.old-deja/g++.law/cvt8.C index 5743cba..cecec9c 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/cvt8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/cvt8.C @@ -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); } diff --git a/gcc/testsuite/g++.old-deja/g++.law/init8.C b/gcc/testsuite/g++.old-deja/g++.law/init8.C index ba8dde2..5ed619b 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/init8.C +++ b/gcc/testsuite/g++.old-deja/g++.law/init8.C @@ -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) ; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net12.C b/gcc/testsuite/g++.old-deja/g++.mike/net12.C index 59e062a..f27dd46 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net12.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net12.C @@ -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 diff --git a/gcc/testsuite/g++.old-deja/g++.mike/net8.C b/gcc/testsuite/g++.old-deja/g++.mike/net8.C index 09f9c30..d1f6864 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/net8.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/net8.C @@ -11,14 +11,14 @@ public: 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" } { } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2793.C b/gcc/testsuite/g++.old-deja/g++.mike/p2793.C index 68fee7d..a331d65 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2793.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2793.C @@ -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 "" } } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p3836.C b/gcc/testsuite/g++.old-deja/g++.mike/p3836.C index 77f859b..08d1562 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p3836.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p3836.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p418.C b/gcc/testsuite/g++.old-deja/g++.mike/p418.C index 4128840..544d5ca 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p418.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p418.C @@ -11,7 +11,7 @@ public: 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 diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p701.C b/gcc/testsuite/g++.old-deja/g++.mike/p701.C index 6a52591..8e9a345 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p701.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p701.C @@ -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; } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p807.C b/gcc/testsuite/g++.old-deja/g++.mike/p807.C index 7b343a5..e2f2b71 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p807.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p807.C @@ -24,7 +24,7 @@ class B }; -int foo(B& b); // { dg-error "" } referenced below +int foo(B& b); // { dg-message "" } referenced below int main() |