From b872d7297d35e31f3254c5476e2ed4fa068e75db Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 2 Jun 2016 23:10:33 +0000 Subject: [PATCH] decl.c (xref_tag_1): Change pairs of errors to error + inform. /cp 2016-06-02 Paolo Carlini * decl.c (xref_tag_1): Change pairs of errors to error + inform. (start_enum): Likewise. * parser.c (cp_parser_class_head): Likewise. /testsuite 2016-06-02 Paolo Carlini * g++.dg/cpp0x/forw_enum10.C: Adjust for dg-message vs dg-error. * g++.dg/cpp0x/forw_enum6.C: Likewise. * g++.dg/cpp0x/forw_enum8.C: Likewise. * g++.dg/cpp0x/override2.C: Likewise. * g++.dg/parse/crash5.C: Likewise. * g++.dg/parse/error16.C: Likewise. * g++.dg/parse/error27.C: Likewise. * g++.dg/template/qualttp15.C: Likewise. * g++.dg/template/redecl4.C: Likewise. * g++.old-deja/g++.other/crash39.C: Likewise. * g++.old-deja/g++.other/struct1.C: Likewise. * g++.old-deja/g++.pt/m9a.C: Likewise. * g++.old-deja/g++.pt/memclass10.C: Likewise. From-SVN: r237046 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 14 +++++++------- gcc/cp/parser.c | 4 ++-- gcc/testsuite/ChangeLog | 16 ++++++++++++++++ gcc/testsuite/g++.dg/cpp0x/forw_enum10.C | 4 ++-- gcc/testsuite/g++.dg/cpp0x/forw_enum6.C | 8 ++++---- gcc/testsuite/g++.dg/cpp0x/forw_enum8.C | 4 ++-- gcc/testsuite/g++.dg/cpp0x/override2.C | 4 ++-- gcc/testsuite/g++.dg/parse/crash5.C | 2 +- gcc/testsuite/g++.dg/parse/error16.C | 2 +- gcc/testsuite/g++.dg/parse/error27.C | 4 ++-- gcc/testsuite/g++.dg/template/qualttp15.C | 2 +- gcc/testsuite/g++.dg/template/redecl4.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/crash39.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/struct1.C | 10 +++++----- gcc/testsuite/g++.old-deja/g++.pt/m9a.C | 2 +- gcc/testsuite/g++.old-deja/g++.pt/memclass10.C | 2 +- 17 files changed, 55 insertions(+), 33 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 651407151ab..fba9aa9e048 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-06-02 Paolo Carlini + + * decl.c (xref_tag_1): Change pairs of errors to error + inform. + (start_enum): Likewise. + * parser.c (cp_parser_class_head): Likewise. + 2016-06-02 Jakub Jelinek PR c++/71372 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index cbbb84b9d0c..cd7143b409c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12793,7 +12793,7 @@ xref_tag_1 (enum tag_types tag_code, tree name, && CLASSTYPE_IS_TEMPLATE (t)) { error ("redeclaration of %qT as a non-template", t); - error ("previous declaration %q+D", t); + inform (location_of (t), "previous declaration %qD", t); return error_mark_node; } @@ -13149,16 +13149,16 @@ start_enum (tree name, tree enumtype, tree underlying_type, { error_at (input_location, "scoped/unscoped mismatch " "in enum %q#T", enumtype); - error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), - "previous definition here"); + inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), + "previous definition here"); enumtype = error_mark_node; } else if (ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) != !! underlying_type) { error_at (input_location, "underlying type mismatch " "in enum %q#T", enumtype); - error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), - "previous definition here"); + inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), + "previous definition here"); enumtype = error_mark_node; } else if (underlying_type && ENUM_UNDERLYING_TYPE (enumtype) @@ -13169,8 +13169,8 @@ start_enum (tree name, tree enumtype, tree underlying_type, { error_at (input_location, "different underlying type " "in enum %q#T", enumtype); - error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), - "previous definition here"); + inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)), + "previous definition here"); underlying_type = NULL_TREE; } } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 29a1b804e73..e01353d5dc1 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22008,8 +22008,8 @@ cp_parser_class_head (cp_parser* parser, { error_at (type_start_token->location, "redefinition of %q#T", type); - error_at (type_start_token->location, "previous definition of %q+#T", - type); + inform (location_of (type), "previous definition of %q#T", + type); type = NULL_TREE; goto done; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 899e2bced1f..7f659c8ec20 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2016-06-02 Paolo Carlini + + * g++.dg/cpp0x/forw_enum10.C: Adjust for dg-message vs dg-error. + * g++.dg/cpp0x/forw_enum6.C: Likewise. + * g++.dg/cpp0x/forw_enum8.C: Likewise. + * g++.dg/cpp0x/override2.C: Likewise. + * g++.dg/parse/crash5.C: Likewise. + * g++.dg/parse/error16.C: Likewise. + * g++.dg/parse/error27.C: Likewise. + * g++.dg/template/qualttp15.C: Likewise. + * g++.dg/template/redecl4.C: Likewise. + * g++.old-deja/g++.other/crash39.C: Likewise. + * g++.old-deja/g++.other/struct1.C: Likewise. + * g++.old-deja/g++.pt/m9a.C: Likewise. + * g++.old-deja/g++.pt/memclass10.C: Likewise. + 2016-06-02 Jakub Jelinek PR c++/71372 diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C index 609c2728957..3c4c3de6d66 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C @@ -3,7 +3,7 @@ //This error is diagnosed at instantiation time template struct S1 { - enum E : T; // { dg-error "previous definition" } + enum E : T; // { dg-message "previous definition" } enum E : int; // { dg-error "different underlying type" } }; template struct S1; // { dg-message "required from here" } @@ -24,7 +24,7 @@ template struct S3; template struct S4 { - enum E : T1; // { dg-error "previous definition" } + enum E : T1; // { dg-message "previous definition" } enum E : T2; // { dg-error "different underlying type" } }; template struct S4; // { dg-message "required from here" } diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C index 7d2094df52b..01bf563bcdd 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum6.C @@ -1,18 +1,18 @@ // { dg-do compile { target c++11 } } -enum class E1 : int; // { dg-error "previous definition" } +enum class E1 : int; // { dg-message "previous definition" } enum E1 : int; // { dg-error "scoped/unscoped mismatch" } -enum E2 : int; // { dg-error "previous definition" } +enum E2 : int; // { dg-message "previous definition" } enum class E2 : int; // { dg-error "scoped/unscoped mismatch" } enum struct E3 : int; enum class E3 : int; //ok -enum class E4 : int; // { dg-error "previous definition" } +enum class E4 : int; // { dg-message "previous definition" } enum class E4 : long; // { dg-error "different underlying type" } -enum E5 : int; // { dg-error "previous definition" } +enum E5 : int; // { dg-message "previous definition" } enum E5 : long; // { dg-error "different underlying type" } enum E6 : int; diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C index 5174226a6fd..b84a759c6de 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum8.C @@ -11,7 +11,7 @@ template struct S1; //ok //This error is diagnosed at instantiation time template struct S2 { - enum E : int; // { dg-error "previous definition" } + enum E : int; // { dg-message "previous definition" } enum E : T; // { dg-error "different underlying type" } }; template struct S2; // { dg-message "required from here" } @@ -19,7 +19,7 @@ template struct S2; // { dg-message "required from here" } //This error is diagnosed at compilation time template struct S3 { - enum E : int; // { dg-error "previous definition" } + enum E : int; // { dg-message "previous definition" } enum E : short; // { dg-error "different underlying type" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/override2.C b/gcc/testsuite/g++.dg/cpp0x/override2.C index c0b89de2a12..ab4dec486c6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/override2.C +++ b/gcc/testsuite/g++.dg/cpp0x/override2.C @@ -38,7 +38,7 @@ int main() { D3 d; D4 d2; - struct B2 final{}; // { dg-error "previous definition" } + struct B2 final{}; // { dg-message "previous definition" } B2 final; // { dg-error "has a previous declaration|previously declared here" } B2 final2 = final; struct B2 {}; // { dg-error "redefinition" } @@ -47,7 +47,7 @@ int main() struct B2 final {}; // { dg-error "redefinition" } struct B2 override {}; // { dg-error "cannot specify 'override' for a class" } B2 override{}; // { dg-error "redeclaration" } - struct foo final {}; // { dg-error "previous definition" } + struct foo final {}; // { dg-message "previous definition" } struct foo final {}; // { dg-error "redefinition" } foo final; // { dg-error "conflicting declaration" } } diff --git a/gcc/testsuite/g++.dg/parse/crash5.C b/gcc/testsuite/g++.dg/parse/crash5.C index d51f8ed7a51..4a06173f07f 100644 --- a/gcc/testsuite/g++.dg/parse/crash5.C +++ b/gcc/testsuite/g++.dg/parse/crash5.C @@ -1,6 +1,6 @@ // { dg-options "-w" } -class QString { // { dg-error "previous definition" } +class QString { // { dg-message "previous definition" } QString (const QString & a); // { dg-message "QString::QString|candidate expects" } }; diff --git a/gcc/testsuite/g++.dg/parse/error16.C b/gcc/testsuite/g++.dg/parse/error16.C index 3d9dcc334e5..74db15c2105 100644 --- a/gcc/testsuite/g++.dg/parse/error16.C +++ b/gcc/testsuite/g++.dg/parse/error16.C @@ -3,7 +3,7 @@ struct A { - struct B {}; // { dg-error "10:previous definition of 'struct A::B'" } + struct B {}; // { dg-message "10:previous definition of 'struct A::B'" } }; struct A::B{}; // { dg-error "11:redefinition of 'struct A::B'" } diff --git a/gcc/testsuite/g++.dg/parse/error27.C b/gcc/testsuite/g++.dg/parse/error27.C index 90cb231c0ac..a86834ef731 100644 --- a/gcc/testsuite/g++.dg/parse/error27.C +++ b/gcc/testsuite/g++.dg/parse/error27.C @@ -1,8 +1,8 @@ // { dg-options "-fshow-column -ansi -pedantic-errors -Wno-long-long" } // PR c++/20152 -struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "8:previous definition of 'struct KrSelectionMode'" } -struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "8:previous definition of 'struct KrKDESelectionMode'" } +struct KrSelectionMode { virtual void init() = 0; }; // { dg-message "8:previous definition of 'struct KrSelectionMode'" } +struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-message "8:previous definition of 'struct KrKDESelectionMode'" } struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "8:redefinition of 'struct KrSelectionMode'" } struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "8:redefinition of 'struct KrKDESelectionMode'" } KrKDESelectionMode krKDESelectionMode; diff --git a/gcc/testsuite/g++.dg/template/qualttp15.C b/gcc/testsuite/g++.dg/template/qualttp15.C index b1c61195d42..9e8ce577b8f 100644 --- a/gcc/testsuite/g++.dg/template/qualttp15.C +++ b/gcc/testsuite/g++.dg/template/qualttp15.C @@ -12,7 +12,7 @@ template