Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59920 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/array-declared-as-incorrect-type.c b/test/Sema/array-declared-as-incorrect-type.c
index e7dd458..9b7d8b7 100644
--- a/test/Sema/array-declared-as-incorrect-type.c
+++ b/test/Sema/array-declared-as-incorrect-type.c
@@ -3,14 +3,14 @@
extern int a1[];
int a1[1];
-extern int a2[]; // expected-error {{previous definition is here}}
+extern int a2[]; // expected-note {{previous definition is here}}
float a2[1]; // expected-error {{redefinition of 'a2'}}
extern int a3[][2];
int a3[1][2];
-extern int a4[][2]; // expected-error {{previous definition is here}}
+extern int a4[][2]; // expected-note {{previous definition is here}}
int a4[2]; // expected-error {{redefinition of 'a4'}}
-extern int a5[1][2][3]; // expected-error {{previous definition is here}}
+extern int a5[1][2][3]; // expected-note {{previous definition is here}}
int a5[3][2][1]; // expected-error {{redefinition of 'a5'}}
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index ba93aaa..b06882b 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -30,8 +30,8 @@
}
// PR2020
-union u0; // expected-error {{previous use is here}}
-enum u0 { U0A }; // expected-error {{error: use of 'u0' with tag type that does not match previous declaration}}
+union u0; // expected-note {{previous use is here}}
+enum u0 { U0A }; // expected-error {{use of 'u0' with tag type that does not match previous declaration}}
// rdar://6095136
@@ -52,6 +52,6 @@
enum someenum {}; // expected-warning {{use of empty enum extension}}
// <rdar://problem/6093889>
-enum e0 { // expected-error {{previous definition is here}}
+enum e0 { // expected-note {{previous definition is here}}
E0 = sizeof(enum e0 { E1 }) // expected-error {{nested redefinition}}
};
diff --git a/test/Sema/function.c b/test/Sema/function.c
index 152205d..7c67bba 100644
--- a/test/Sema/function.c
+++ b/test/Sema/function.c
@@ -6,15 +6,15 @@
int foo (__const char *__path);
int foo(__const char *__restrict __file);
-void func(const char*); //expected-error{{previous declaration is here}}
-void func(char*); //expected-error{{conflicting types for 'func'}}
+void func(const char*); // expected-note {{previous declaration is here}}
+void func(char*); // expected-error{{conflicting types for 'func'}}
void g(int (*)(const void **, const void **));
void g(int (*compar)()) {
}
-void h(); //expected-error{{previous declaration is here}}
-void h (const char *fmt, ...) {} //expected-error{{conflicting types for 'h'}}
+void h(); // expected-note {{previous declaration is here}}
+void h (const char *fmt, ...) {} // expected-error{{conflicting types for 'h'}}
// PR1965
int t5(b); // expected-error {{parameter list without types}}
diff --git a/test/Sema/implicit-decl.c b/test/Sema/implicit-decl.c
index ea40e61..099cf9d 100644
--- a/test/Sema/implicit-decl.c
+++ b/test/Sema/implicit-decl.c
@@ -7,7 +7,7 @@
int32_t *vector[16];
const char compDesc[16 + 1];
int32_t compCount = 0;
- if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error{{previous implicit declaration is here}}
+ if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}}
}
return ((void *)0);
}
diff --git a/test/Sema/merge-decls.c b/test/Sema/merge-decls.c
index 50ce478..b26532c 100644
--- a/test/Sema/merge-decls.c
+++ b/test/Sema/merge-decls.c
@@ -3,7 +3,7 @@
void foo(void);
void foo(void) {}
void foo(void);
-void foo(void); // expected-error{{previous declaration is here}}
+void foo(void); // expected-note {{previous declaration is here}}
void foo(int); // expected-error {{conflicting types for 'foo'}}
@@ -14,6 +14,6 @@
int funcdef();
-int funcdef2() { return 0; } // expected-error{{previous definition is here}}
+int funcdef2() { return 0; } // expected-note {{previous definition is here}}
int funcdef2() { return 0; } // expected-error {{redefinition of 'funcdef2'}}
diff --git a/test/Sema/predefined-function.c b/test/Sema/predefined-function.c
index e8c3965..2a254cc 100644
--- a/test/Sema/predefined-function.c
+++ b/test/Sema/predefined-function.c
@@ -4,7 +4,7 @@
enum Test {A=-1};
char *funk(enum Test x);
-int eli(float b); // expected-error {{previous declaration is here}}
+int eli(float b); // expected-note {{previous declaration is here}}
int b(int c) {return 1;}
int foo();
@@ -16,7 +16,7 @@
}
int bar();
-int bar(int i) // expected-error {{previous definition is here}}
+int bar(int i) // expected-note {{previous definition is here}}
{
return 0;
}
@@ -26,14 +26,14 @@
}
#if 0
-int foobar(int); // error {{previous declaration is here}}
+int foobar(int); // note {{previous declaration is here}}
int foobar() // error {{conflicting types for 'foobar'}}
{
return 0;
}
#endif
-int wibble(); // expected-error {{previous declaration is here}}
+int wibble(); // expected-note {{previous declaration is here}}
float wibble() // expected-error {{conflicting types for 'wibble'}}
{
return 0.0f;
diff --git a/test/Sema/redefinition.c b/test/Sema/redefinition.c
index c45779f..9ad77f6 100644
--- a/test/Sema/redefinition.c
+++ b/test/Sema/redefinition.c
@@ -1,5 +1,5 @@
// RUN: clang %s -fsyntax-only -verify
-int f(int) { } // expected-error{{previous definition is here}}
+int f(int) { } // expected-note {{previous definition is here}}
int f(int);
-int f(int) { } // expected-error{{redefinition of 'f'}}
+int f(int) { } // expected-error {{redefinition of 'f'}}
diff --git a/test/Sema/struct-compat.c b/test/Sema/struct-compat.c
index a4492d1..489ff47 100644
--- a/test/Sema/struct-compat.c
+++ b/test/Sema/struct-compat.c
@@ -1,17 +1,17 @@
/* RUN: clang %s -fsyntax-only -pedantic -verify
*/
-extern struct {int a;} x; // expected-error{{previous definition is here}}
-extern struct {int a;} x; // expected-error{{redefinition of 'x'}}
+extern struct {int a;} x; // expected-note {{previous definition is here}}
+extern struct {int a;} x; // expected-error {{redefinition of 'x'}}
struct x;
int a(struct x* b) {
// Per C99 6.7.2.3, since the outer and inner "struct x"es have different
// scopes, they don't refer to the same type, and are therefore incompatible
-struct x {int a;} *c = b; // expected-warning{{incompatible pointer types}}
+struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}}
}
struct x {int a;} r;
int b() {
-struct x {char x;} s = r; // expected-error{{incompatible type initializing}}
+struct x {char x;} s = r; // expected-error {{incompatible type initializing}}
}
diff --git a/test/Sema/switch-duplicate-defaults.c b/test/Sema/switch-duplicate-defaults.c
deleted file mode 100644
index 9ef683b..0000000
--- a/test/Sema/switch-duplicate-defaults.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: clang -fsyntax-only -verify %s
-
-void f (int z) {
- switch(z) {
- default: // expected-error {{first label is here}}
- default: // expected-error {{multiple default labels in one switch}}
- break;
- }
-}
-
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index 63e5fe3..5886fef 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -8,17 +8,17 @@
void foo(int X) {
switch (X) {
- case 42: ; // expected-error {{previous case value}}
+ case 42: ; // expected-note {{previous case}}
case 5000000000LL: // expected-warning {{overflow}}
case 42: // expected-error {{duplicate case value}}
;
case 100 ... 99: ; // expected-warning {{empty case range}}
- case 43: ; // expected-error {{previous case value}}
+ case 43: ; // expected-note {{previous case}}
case 43 ... 45: ; // expected-error {{duplicate case value}}
- case 100 ... 20000:; // expected-error {{previous case value}}
+ case 100 ... 20000:; // expected-note {{previous case}}
case 15000 ... 40000000:; // expected-error {{duplicate case value}}
}
}
@@ -60,3 +60,11 @@
}
}
+void test5(int z) {
+ switch(z) {
+ default: // expected-note {{previous case defined here}}
+ default: // expected-error {{multiple default labels in one switch}}
+ break;
+ }
+}
+
diff --git a/test/Sema/tentative-decls.c b/test/Sema/tentative-decls.c
index 3a2fd5a..0e4b13a 100644
--- a/test/Sema/tentative-decls.c
+++ b/test/Sema/tentative-decls.c
@@ -9,12 +9,12 @@
extern const int c[] = {1}; // expected-warning{{'extern' variable has an initializer}}
const int c[];
-int i1 = 1; // expected-error{{previous definition is here}}
-int i1 = 2; // expected-error{{redefinition of 'i1'}} // expected-error{{previous definition is here}}
+int i1 = 1; // expected-note {{previous definition is here}}
+int i1 = 2; // expected-error {{redefinition of 'i1'}} // expected-note {{previous definition is here}}
int i1;
int i1;
-extern int i1; // expected-error{{previous definition is here}}
-static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-error{{previous definition is here}}
+extern int i1; // expected-note {{previous definition is here}}
+static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}} expected-note {{previous definition is here}}
int i1 = 3; // expected-error{{redefinition of 'i1'}} expected-error{{non-static declaration of 'i1' follows static declaration}}
__private_extern__ int pExtern;
@@ -28,11 +28,11 @@
int (*pToArray)[8];
int redef[10];
-int redef[]; // expected-error{{previous definition is here}}
+int redef[]; // expected-note {{previous definition is here}}
int redef[11]; // expected-error{{redefinition of 'redef'}}
void func() {
- extern int i1; // expected-error{{previous definition is here}}
+ extern int i1; // expected-note {{previous definition is here}}
static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
}
diff --git a/test/Sema/typedef-redef.c b/test/Sema/typedef-redef.c
index d3904dd..76b8a3c 100644
--- a/test/Sema/typedef-redef.c
+++ b/test/Sema/typedef-redef.c
@@ -6,7 +6,7 @@
-typedef const int x; // expected-error {{previous definition is here}}
+typedef const int x; // expected-note {{previous definition is here}}
extern x a;
typedef int x; // expected-error {{typedef redefinition with different types}}
extern x a;