From: Volker Reichelt Date: Tue, 27 Mar 2018 17:21:20 +0000 (+0000) Subject: search.c (check_final_overrider): Use inform instead of error for the diagnostics... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d555040fc4c7e7b023c23e5c0f4889936a154ca9;p=gcc.git search.c (check_final_overrider): Use inform instead of error for the diagnostics of the overridden functions. 2018-03-27 Volker Reichelt * search.c (check_final_overrider): Use inform instead of error for the diagnostics of the overridden functions. Tweak wording. * g++.dg/cpp0x/defaulted2.C: Use dg-message instead of dg-error for the diagnostics of overridden functions. Adjust for new wording. * g++.dg/cpp0x/implicit1.C: Likewise. * g++.dg/cpp0x/override1.C: Likewise. * g++.dg/cpp1y/auto-fn18.C: Likewise. * g++.dg/eh/shadow1.C: Likewise. * g++.dg/inherit/covariant12.C: Likewise. * g++.dg/inherit/covariant14.C: Likewise. * g++.dg/inherit/covariant15.C: Likewise. * g++.dg/inherit/covariant16.C: Likewise. * g++.dg/inherit/covariant22.C: Likewise. * g++.dg/inherit/crash3.C: Likewise. * g++.dg/inherit/error2.C: Likewise. * g++.dg/template/crash100.C: Likewise. * g++.old-deja/g++.eh/spec6.C: Likewise. * g++.old-deja/g++.mike/p811.C: Likewise. * g++.old-deja/g++.other/virtual11.C: Likewise. * g++.old-deja/g++.other/virtual4.C: Likewise. From-SVN: r258898 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1f035c30dac..f7f48879b6f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-03-27 Volker Reichelt + + * search.c (check_final_overrider): Use inform instead of error + for the diagnostics of the overridden functions. Tweak wording. + 2018-03-27 Jakub Jelinek PR c++/85068 diff --git a/gcc/cp/search.c b/gcc/cp/search.c index b4366102e23..6bf8b0e70dc 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1904,7 +1904,7 @@ check_final_overrider (tree overrider, tree basefn) if (pedwarn (DECL_SOURCE_LOCATION (overrider), 0, "invalid covariant return type for %q#D", overrider)) inform (DECL_SOURCE_LOCATION (basefn), - " overriding %q#D", basefn); + "overridden function is %q#D", basefn); } else fail = 2; @@ -1918,12 +1918,14 @@ check_final_overrider (tree overrider, tree basefn) if (fail == 1) { error ("invalid covariant return type for %q+#D", overrider); - error (" overriding %q+#D", basefn); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %q#D", basefn); } else { error ("conflicting return type specified for %q+#D", overrider); - error (" overriding %q+#D", basefn); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %q#D", basefn); } DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; @@ -1938,7 +1940,8 @@ check_final_overrider (tree overrider, tree basefn) if (!comp_except_specs (base_throw, over_throw, ce_derived)) { error ("looser throw specifier for %q+#F", overrider); - error (" overriding %q+#F", basefn); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %q#F", basefn); DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; } @@ -1950,7 +1953,8 @@ check_final_overrider (tree overrider, tree basefn) && !tx_safe_fn_type_p (over_type)) { error ("conflicting type attributes specified for %q+#D", overrider); - error (" overriding %q+#D", basefn); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %q#D", basefn); DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; } @@ -1974,21 +1978,26 @@ check_final_overrider (tree overrider, tree basefn) { if (DECL_DELETED_FN (overrider)) { - error ("deleted function %q+D", overrider); - error ("overriding non-deleted function %q+D", basefn); + error ("deleted function %q+D overriding non-deleted function", + overrider); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %qD", basefn); maybe_explain_implicit_delete (overrider); } else { - error ("non-deleted function %q+D", overrider); - error ("overriding deleted function %q+D", basefn); + error ("non-deleted function %q+D overriding deleted function", + overrider); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %qD", basefn); } return 0; } if (DECL_FINAL_P (basefn)) { - error ("virtual function %q+D", overrider); - error ("overriding final function %q+D", basefn); + error ("virtual function %q+D overriding final function", overrider); + inform (DECL_SOURCE_LOCATION (basefn), + "overridden function is %qD", basefn); return 0; } return 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index be9044d644e..292cfedac1e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2018-03-27 Volker Reichelt + + * g++.dg/cpp0x/defaulted2.C: Use dg-message instead of dg-error + for the diagnostics of overridden functions. Adjust for new wording. + * g++.dg/cpp0x/implicit1.C: Likewise. + * g++.dg/cpp0x/override1.C: Likewise. + * g++.dg/cpp1y/auto-fn18.C: Likewise. + * g++.dg/eh/shadow1.C: Likewise. + * g++.dg/inherit/covariant12.C: Likewise. + * g++.dg/inherit/covariant14.C: Likewise. + * g++.dg/inherit/covariant15.C: Likewise. + * g++.dg/inherit/covariant16.C: Likewise. + * g++.dg/inherit/covariant22.C: Likewise. + * g++.dg/inherit/crash3.C: Likewise. + * g++.dg/inherit/error2.C: Likewise. + * g++.dg/template/crash100.C: Likewise. + * g++.old-deja/g++.eh/spec6.C: Likewise. + * g++.old-deja/g++.mike/p811.C: Likewise. + * g++.old-deja/g++.other/virtual11.C: Likewise. + * g++.old-deja/g++.other/virtual4.C: Likewise. + 2018-03-27 H.J. Lu PR target/85044 diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C index 63be99754cd..45b09c17812 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C @@ -25,7 +25,7 @@ const B b; // { dg-error "uninitialized const" } struct C { - virtual void f() = delete; // { dg-error "overriding deleted" } + virtual void f() = delete; // { dg-message "overridden" } }; struct D: public C diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit1.C b/gcc/testsuite/g++.dg/cpp0x/implicit1.C index e784ee4e2da..7fdd262dc58 100644 --- a/gcc/testsuite/g++.dg/cpp0x/implicit1.C +++ b/gcc/testsuite/g++.dg/cpp0x/implicit1.C @@ -7,7 +7,7 @@ class C { void operator delete (void *); // { dg-message "private" } public: - virtual ~C(); // { dg-error "overriding" } + virtual ~C(); // { dg-message "overridden" } }; struct D: C { }; // { dg-error "deleted" } @@ -20,7 +20,7 @@ struct E struct F { - virtual ~F(); // { dg-error "overriding" } + virtual ~F(); // { dg-message "overridden" } }; struct G: E, F { }; // { dg-error "deleted" } diff --git a/gcc/testsuite/g++.dg/cpp0x/override1.C b/gcc/testsuite/g++.dg/cpp0x/override1.C index 7686a286fc6..543ac840cf2 100644 --- a/gcc/testsuite/g++.dg/cpp0x/override1.C +++ b/gcc/testsuite/g++.dg/cpp0x/override1.C @@ -7,7 +7,7 @@ struct B virtual void y() final; }; -void B::y() {} // { dg-error "overriding" } +void B::y() {} // { dg-message "overridden" } struct B2 { @@ -16,7 +16,7 @@ struct B2 struct D : B { - virtual void g() override final {} // { dg-error "overriding" } + virtual void g() override final {} // { dg-message "overridden" } virtual void y() override final {} // { dg-error "virtual" } }; diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn18.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn18.C index 528d3d45ed7..1a9296459da 100644 --- a/gcc/testsuite/g++.dg/cpp1y/auto-fn18.C +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn18.C @@ -2,7 +2,7 @@ struct A { - virtual int f() { return 1; } // { dg-message "overriding" } + virtual int f() { return 1; } // { dg-message "overridden" } virtual auto g() { return 1; } // { dg-error "virtual" } }; diff --git a/gcc/testsuite/g++.dg/eh/shadow1.C b/gcc/testsuite/g++.dg/eh/shadow1.C index f0de449564e..0ba6145ef0c 100644 --- a/gcc/testsuite/g++.dg/eh/shadow1.C +++ b/gcc/testsuite/g++.dg/eh/shadow1.C @@ -13,7 +13,7 @@ struct D : private B friend class E; static B *baz (D *); - virtual void V () throw (B); // { dg-error "overriding" "" { target { ! c++17 } } } + virtual void V () throw (B); // { dg-message "overridden" "" { target { ! c++17 } } } }; // { dg-error "dynamic exception specification" "" { target c++17 } .-1 } // { dg-warning "deprecated" "" { target { c++11 && { ! c++17 } } } .-2 } struct E : public D diff --git a/gcc/testsuite/g++.dg/inherit/covariant12.C b/gcc/testsuite/g++.dg/inherit/covariant12.C index e7247f2e2f0..a340dc9f887 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant12.C +++ b/gcc/testsuite/g++.dg/inherit/covariant12.C @@ -9,7 +9,7 @@ struct S; struct B { - virtual T *Foo (); // { dg-error "overriding" } + virtual T *Foo (); // { dg-message "overridden" } }; struct D : B diff --git a/gcc/testsuite/g++.dg/inherit/covariant14.C b/gcc/testsuite/g++.dg/inherit/covariant14.C index 51182437b3c..ce500bf0459 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant14.C +++ b/gcc/testsuite/g++.dg/inherit/covariant14.C @@ -8,7 +8,7 @@ struct A; struct B { - virtual A* foo(); // { dg-error "overriding" } + virtual A* foo(); // { dg-message "overridden" } }; namespace N diff --git a/gcc/testsuite/g++.dg/inherit/covariant15.C b/gcc/testsuite/g++.dg/inherit/covariant15.C index 4696cc6334a..ab97ad1b4e3 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant15.C +++ b/gcc/testsuite/g++.dg/inherit/covariant15.C @@ -5,7 +5,7 @@ struct A {}; class B : A { - virtual A* foo(); /* { dg-error "overriding" } */ + virtual A* foo(); /* { dg-message "overridden" } */ }; struct C : virtual B diff --git a/gcc/testsuite/g++.dg/inherit/covariant16.C b/gcc/testsuite/g++.dg/inherit/covariant16.C index de9307e8931..e9cb769e2cf 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant16.C +++ b/gcc/testsuite/g++.dg/inherit/covariant16.C @@ -8,7 +8,7 @@ struct A struct B : virtual A { - virtual B* foo(); /* { dg-error "overriding" } */ + virtual B* foo(); /* { dg-message "overridden" } */ }; struct C : B diff --git a/gcc/testsuite/g++.dg/inherit/covariant22.C b/gcc/testsuite/g++.dg/inherit/covariant22.C index 26c96e6abfc..9826f9d0128 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant22.C +++ b/gcc/testsuite/g++.dg/inherit/covariant22.C @@ -5,7 +5,7 @@ struct A; struct B { - virtual A *foo (); // { dg-error "overriding" } + virtual A *foo (); // { dg-message "overridden" } }; struct C : virtual B diff --git a/gcc/testsuite/g++.dg/inherit/crash3.C b/gcc/testsuite/g++.dg/inherit/crash3.C index e6094b04a64..62b9e21f5dd 100644 --- a/gcc/testsuite/g++.dg/inherit/crash3.C +++ b/gcc/testsuite/g++.dg/inherit/crash3.C @@ -2,7 +2,7 @@ struct A { - virtual int& foo(); // { dg-error "overriding" } + virtual int& foo(); // { dg-message "overridden" } }; struct B : A diff --git a/gcc/testsuite/g++.dg/inherit/error2.C b/gcc/testsuite/g++.dg/inherit/error2.C index 7d5e2e5d689..a19c48fc1f9 100644 --- a/gcc/testsuite/g++.dg/inherit/error2.C +++ b/gcc/testsuite/g++.dg/inherit/error2.C @@ -3,7 +3,7 @@ struct A { - virtual A* foo(); // { dg-error "overriding" } + virtual A* foo(); // { dg-message "overridden" } }; struct B : virtual A; // { dg-error "before" } diff --git a/gcc/testsuite/g++.dg/template/crash100.C b/gcc/testsuite/g++.dg/template/crash100.C index c67ae2eca38..a85948caf9a 100644 --- a/gcc/testsuite/g++.dg/template/crash100.C +++ b/gcc/testsuite/g++.dg/template/crash100.C @@ -7,7 +7,7 @@ class Temp public: operator T&(void) { return Val; } - virtual T& operator=(T a ) // { dg-error "overriding" } + virtual T& operator=(T a ) // { dg-message "overridden" } { Val = a; return Val; diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C index ed485e299ec..587eb323992 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C @@ -81,19 +81,19 @@ struct G : public F, F1 {}; struct H : private E {}; struct A { - virtual void foo() throw(); // { dg-error "" } overriding + virtual void foo() throw(); // { dg-message "" } overridden virtual void baz() throw(double, int); virtual void bar(); virtual void qux() throw(E); - virtual void qux(int) throw(E const *); // { dg-error "" } overriding (pedantically) - virtual void quux() throw(F); // { dg-error "" } overriding - virtual void quux(int) throw(F *); // { dg-error "" } overriding - virtual void wibble() throw(E); // { dg-error "" } overriding - virtual void wobble() throw(E *); // { dg-error "" } overriding - virtual void wobble(int) throw(E *); // { dg-error "" } overriding + virtual void qux(int) throw(E const *); // { dg-message "" } overridden (pedantically) + virtual void quux() throw(F); // { dg-message "" } overridden + virtual void quux(int) throw(F *); // { dg-message "" } overridden + virtual void wibble() throw(E); // { dg-message "" } overridden + virtual void wobble() throw(E *); // { dg-message "" } overridden + virtual void wobble(int) throw(E *); // { dg-message "" } overridden virtual void wabble(int) throw(E *); virtual void wubble(int) throw(E *, H *); - virtual ~A() throw(); // { dg-error "" } overriding + virtual ~A() throw(); // { dg-message "" } overriding }; struct B : A @@ -115,7 +115,7 @@ struct B : A struct A1 { virtual void foo() throw(int); - virtual void bar() throw(); // { dg-error "" } overriding + virtual void bar() throw(); // { dg-message "" } overridden virtual ~A1() throw(int); }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p811.C b/gcc/testsuite/g++.old-deja/g++.mike/p811.C index bebfe6b7e20..174b16e1eee 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p811.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p811.C @@ -512,7 +512,7 @@ class Y { public: Y() {} virtual const char *stringify() = 0; - virtual char *stringify2() const = 0; // { dg-error "overriding" } + virtual char *stringify2() const = 0; // { dg-message "overridden" } }; class X: public Y { // { dg-message "defined here" } diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual11.C b/gcc/testsuite/g++.old-deja/g++.other/virtual11.C index 8b46dc75421..172216abc1d 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/virtual11.C +++ b/gcc/testsuite/g++.old-deja/g++.other/virtual11.C @@ -12,7 +12,7 @@ struct A struct B { - virtual void foo (); // { dg-error "" } of this function + virtual void foo (); // { dg-message "" } of this function }; struct C : A , B diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual4.C b/gcc/testsuite/g++.old-deja/g++.other/virtual4.C index 6933755ab2e..8056f26e473 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/virtual4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/virtual4.C @@ -2,7 +2,7 @@ class A { public: - virtual int foo() = 0; // { dg-error "" } original definition + virtual int foo() = 0; // { dg-message "" } original definition }; class B {