public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] Change a few error + error to error + inform
@ 2016-06-02 21:35 Paolo Carlini
  2016-06-02 21:37 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2016-06-02 21:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

Hi,

while working on c++/70202, I noticed a few more of those pairs for 
errors which we changed in the past to error + inform. Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////////

[-- Attachment #2: CL_2err --]
[-- Type: text/plain, Size: 821 bytes --]

/cp
2016-06-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* 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  <paolo.carlini@oracle.com>

	* 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.

[-- Attachment #3: patch_2err --]
[-- Type: text/plain, Size: 12348 bytes --]

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 237042)
+++ cp/decl.c	(working copy)
@@ -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,8 +13149,8 @@ start_enum (tree name, tree enumtype, tree underly
 	{
 	  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)
@@ -13157,8 +13157,8 @@ start_enum (tree name, tree enumtype, tree underly
 	{
 	  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 underly
 	{
 	  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;
 	}
     }
Index: cp/parser.c
===================================================================
--- cp/parser.c	(revision 237042)
+++ cp/parser.c	(working copy)
@@ -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;
     }
Index: testsuite/g++.dg/cpp0x/forw_enum10.C
===================================================================
--- testsuite/g++.dg/cpp0x/forw_enum10.C	(revision 237042)
+++ testsuite/g++.dg/cpp0x/forw_enum10.C	(working copy)
@@ -3,7 +3,7 @@
 //This error is diagnosed at instantiation time
 template<typename T> 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<short>; // { dg-message "required from here" }
@@ -24,7 +24,7 @@ template struct S3<short,short>;
 
 template<typename T1, typename T2> 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<short,char>; // { dg-message "required from here" }
Index: testsuite/g++.dg/cpp0x/forw_enum6.C
===================================================================
--- testsuite/g++.dg/cpp0x/forw_enum6.C	(revision 237042)
+++ testsuite/g++.dg/cpp0x/forw_enum6.C	(working copy)
@@ -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;
Index: testsuite/g++.dg/cpp0x/forw_enum8.C
===================================================================
--- testsuite/g++.dg/cpp0x/forw_enum8.C	(revision 237042)
+++ testsuite/g++.dg/cpp0x/forw_enum8.C	(working copy)
@@ -11,7 +11,7 @@ template struct S1<int>; //ok
 //This error is diagnosed at instantiation time
 template<typename T> 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<short>; // { dg-message "required from here" }
@@ -19,7 +19,7 @@ template struct S2<short>; // { dg-message "requir
 //This error is diagnosed at compilation time
 template<typename T> struct S3
 {
-    enum E : int;   // { dg-error "previous definition" }
+    enum E : int;   // { dg-message "previous definition" }
     enum E : short; // { dg-error "different underlying type" }
 };
 
Index: testsuite/g++.dg/cpp0x/override2.C
===================================================================
--- testsuite/g++.dg/cpp0x/override2.C	(revision 237042)
+++ testsuite/g++.dg/cpp0x/override2.C	(working copy)
@@ -38,7 +38,7 @@ int main()
 {
   D3<B1> d;
   D4<B2> 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" }
 }
Index: testsuite/g++.dg/parse/crash5.C
===================================================================
--- testsuite/g++.dg/parse/crash5.C	(revision 237042)
+++ testsuite/g++.dg/parse/crash5.C	(working copy)
@@ -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" }
 };
 
Index: testsuite/g++.dg/parse/error16.C
===================================================================
--- testsuite/g++.dg/parse/error16.C	(revision 237042)
+++ testsuite/g++.dg/parse/error16.C	(working copy)
@@ -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'" }
Index: testsuite/g++.dg/parse/error27.C
===================================================================
--- testsuite/g++.dg/parse/error27.C	(revision 237042)
+++ testsuite/g++.dg/parse/error27.C	(working copy)
@@ -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;
Index: testsuite/g++.dg/template/qualttp15.C
===================================================================
--- testsuite/g++.dg/template/qualttp15.C	(revision 237042)
+++ testsuite/g++.dg/template/qualttp15.C	(working copy)
@@ -12,7 +12,7 @@ template <template <class> class TT> struct X
 	TT<int> y;
 };
 
-template <class T> struct X<T::template B> // { dg-error "previous" }
+template <class T> struct X<T::template B> // { dg-message "previous" }
 {
 	T z;
 };
Index: testsuite/g++.dg/template/redecl4.C
===================================================================
--- testsuite/g++.dg/template/redecl4.C	(revision 237042)
+++ testsuite/g++.dg/template/redecl4.C	(working copy)
@@ -1,5 +1,5 @@
 // PR c++/28710
 // { dg-do compile }
 
-template<int> union A;  // { dg-error "previous" }
+template<int> union A;  // { dg-message "previous" }
 struct A;               // { dg-error "non-template" }
Index: testsuite/g++.old-deja/g++.other/crash39.C
===================================================================
--- testsuite/g++.old-deja/g++.other/crash39.C	(revision 237042)
+++ testsuite/g++.old-deja/g++.other/crash39.C	(working copy)
@@ -10,7 +10,7 @@ struct X
 {
   ~X ();
 };
-struct S { X a; };  // { dg-error "" } previous defn
+struct S { X a; };  // { dg-message "" } previous defn
 struct S { X a; };  // { dg-error "" } redefinition
 
 void c1(S s)
Index: testsuite/g++.old-deja/g++.other/struct1.C
===================================================================
--- testsuite/g++.old-deja/g++.other/struct1.C	(revision 237042)
+++ testsuite/g++.old-deja/g++.other/struct1.C	(working copy)
@@ -6,7 +6,7 @@
 // Duplicate definitions are wrong, we should just cough
 // politely, but we used to die horribly.
 
-class Y // { dg-error "" } previous definition
+class Y // { dg-message "" } previous definition
 {
 };
 class Y // { dg-error "" } redefinition
@@ -13,7 +13,7 @@ class Y // { dg-error "" } redefinition
 {   
 };
 
-template<class T> class X // { dg-error "" } previous definition
+template<class T> class X // { dg-message "" } previous definition
 {
 };
 template<class T> class X // { dg-error "" } redefinition
@@ -20,7 +20,7 @@ template<class T> class X // { dg-error "" } redef
 {   
 };
 
-template<class T> class X<T *> // { dg-error "" } previous definition
+template<class T> class X<T *> // { dg-message "" } previous definition
 {
 };
 template<class T> class X<T *> // { dg-error "" } redefinition
@@ -27,7 +27,7 @@ template<class T> class X<T *> // { dg-error "" }
 {   
 };
 
-template<> class X<int> // { dg-error "" } previous definition
+template<> class X<int> // { dg-message "" } previous definition
 {
 };
 template<> class X<int> // { dg-error "" } redefinition
@@ -34,7 +34,7 @@ template<> class X<int> // { dg-error "" } redefin
 {   
 };
 
-template<> class X<int *> // { dg-error "" } previous definition
+template<> class X<int *> // { dg-message "" } previous definition
 {
 };
 template<> class X<int *> // { dg-error "" } redefinition
Index: testsuite/g++.old-deja/g++.pt/m9a.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/m9a.C	(revision 237042)
+++ testsuite/g++.old-deja/g++.pt/m9a.C	(working copy)
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
 
-struct A { A() { a = 1; } int a; }; // { dg-error "" } 
+struct A { A() { a = 1; } int a; }; // { dg-message "" } 
 struct A { A() { a = 2; } int a; }; // { dg-error "" } 
 A aavv;
Index: testsuite/g++.old-deja/g++.pt/memclass10.C
===================================================================
--- testsuite/g++.old-deja/g++.pt/memclass10.C	(revision 237042)
+++ testsuite/g++.old-deja/g++.pt/memclass10.C	(working copy)
@@ -3,7 +3,7 @@
 struct S1
 {
   template <class T>
-  struct S2 {}; // { dg-error "" } previous definition
+  struct S2 {}; // { dg-message "" } previous definition
 
   template <class T>
   struct S2 {}; // { dg-error "" } redefinition 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ Patch] Change a few error + error to error + inform
  2016-06-02 21:35 [C++ Patch] Change a few error + error to error + inform Paolo Carlini
@ 2016-06-02 21:37 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2016-06-02 21:37 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-02 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 21:35 [C++ Patch] Change a few error + error to error + inform Paolo Carlini
2016-06-02 21:37 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).