aboutsummaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/argument-checking.m4
-rw-r--r--test/Sema/array-constraint.c2
-rw-r--r--test/Sema/array-init.c6
-rw-r--r--test/Sema/builtins.c5
-rw-r--r--test/Sema/incompatible-protocol-qualified-types.m2
-rw-r--r--test/Sema/objc-comptypes-1.m14
-rw-r--r--test/Sema/objc-comptypes-3.m18
-rw-r--r--test/Sema/objc-comptypes-5.m4
-rw-r--r--test/Sema/objc-comptypes-6.m4
-rw-r--r--test/Sema/objc-comptypes-7.m34
-rw-r--r--test/Sema/protocol-id-test-3.m4
-rw-r--r--test/Sema/typedef-retain.c4
-rw-r--r--test/Sema/vector-assign.c28
13 files changed, 64 insertions, 65 deletions
diff --git a/test/Sema/argument-checking.m b/test/Sema/argument-checking.m
index 57ab14f1ff..cd84171ee7 100644
--- a/test/Sema/argument-checking.m
+++ b/test/Sema/argument-checking.m
@@ -16,8 +16,8 @@ void test() {
id obj = [Test alloc];
struct S sInst;
- charStarFunc(1); // expected-warning {{incompatible types passing 'int' to function expecting 'char *'}}
- charFunc("abc"); // expected-warning {{incompatible types passing 'char *' to function expecting 'char'}}
+ charStarFunc(1); // expected-warning {{incompatible pointer/int conversion passing 'int', expected 'char *'}}
+ charFunc("abc"); // expected-warning {{incompatible pointer/int conversion passing 'char *', expected 'char'}}
[obj charStarMeth:1]; // expected-warning {{incompatible pointer/int conversion sending 'int'}}
[obj structMeth:1]; // expected-error {{incompatible type sending 'int'}}
diff --git a/test/Sema/array-constraint.c b/test/Sema/array-constraint.c
index f281df1aff..df79681d06 100644
--- a/test/Sema/array-constraint.c
+++ b/test/Sema/array-constraint.c
@@ -45,7 +45,7 @@ typedef int TA[I]; // expected-error {{variable length array declared outside of
void strFunc(char *);
const char staticAry[] = "test";
int checkStaticAry() {
- strFunc(staticAry); // expected-warning{{passing 'char const [5]' to 'char *' discards qualifiers}}
+ strFunc(staticAry); // expected-warning{{passing 'char const [5]' discards qualifiers, expected 'char *'}}
}
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index bf5ea06bab..1875fab389 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -9,7 +9,7 @@ int ary2[] = { x, y, z }; // expected-error{{initializer element is not constant
extern int fileScopeExtern[3] = { 1, 3, 5 }; // expected-warning{{'extern' variable has an initializer}}
-static int ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible types assigning 'char *' to 'int'}}
+static int ary3[] = { 1, "abc", 3, 4 }; // expected-warning{{incompatible pointer/int conversion initializing 'char *', expected 'int'}}
void func() {
int x = 1;
@@ -44,11 +44,11 @@ void func() {
int a,b,c;
} z = { 1 };
- struct threeElements *p = 7; // expected-warning{{incompatible types assigning 'int' to 'struct threeElements *'}}
+ struct threeElements *p = 7; // expected-warning{{incompatible pointer/int conversion initializing 'int', expected 'struct threeElements *'}}
extern int blockScopeExtern[3] = { 1, 3, 5 }; // expected-error{{'extern' variable cannot have an initializer}}
- static int x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible types assigning 'char *' to 'int'}}
+ static int x2[3] = { 1.0, "abc" , 5.8 }; // expected-warning{{incompatible pointer/int conversion initializing 'char *', expected 'int'}}
}
void test() {
diff --git a/test/Sema/builtins.c b/test/Sema/builtins.c
index 997a8ede0e..59a339ad45 100644
--- a/test/Sema/builtins.c
+++ b/test/Sema/builtins.c
@@ -1,4 +1,4 @@
-// RUN: clang %s -fsyntax-only -verify
+// RUN: clang %s -fsyntax-only -verify -pedantic
int test1(float a, int b) {
return __builtin_isless(a, b);
@@ -26,8 +26,7 @@ int test6(float a, long double b) {
void cfstring() {
CFSTR("\242"); // expected-warning {{ CFString literal contains non-ASCII character }}
CFSTR("\0"); // expected-warning {{ CFString literal contains NUL character }}
- CFSTR(242); // expected-error {{ CFString literal is not a string constant }} \
- expected-warning {{incompatible types}}
+ CFSTR(242); // expected-error {{ CFString literal is not a string constant }} expected-warning {{incompatible pointer/int conversion}}
CFSTR("foo", "bar"); // expected-error {{ error: too many arguments to function }}
}
diff --git a/test/Sema/incompatible-protocol-qualified-types.m b/test/Sema/incompatible-protocol-qualified-types.m
index 417dcee2d1..ad8c45e5e0 100644
--- a/test/Sema/incompatible-protocol-qualified-types.m
+++ b/test/Sema/incompatible-protocol-qualified-types.m
@@ -21,7 +21,7 @@ INTF <MyProto1> * Func1(INTF <MyProto1, MyProto2> *p2)
INTF <MyProto1, MyProto2> * Func2(INTF <MyProto1> *p2)
{
- Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *' to function expecting 'INTF<MyProto1,MyProto2> *}}
+ Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
}
diff --git a/test/Sema/objc-comptypes-1.m b/test/Sema/objc-comptypes-1.m
index c4b457ee68..512565c58b 100644
--- a/test/Sema/objc-comptypes-1.m
+++ b/test/Sema/objc-comptypes-1.m
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -verify -pedantic %s
#include <objc/objc.h>
@@ -33,25 +33,25 @@ int main()
/* Assigning to a 'MyClass *' variable should always generate a
warning, unless done from an 'id'. */
obj_c = obj; /* Ok */
- obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning 'MyOtherClass *' to 'MyClass *'}}
- obj_c = obj_C; // expected-warning {{incompatible pointer types assigning 'Class' to 'MyClass *'}}
+ obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning 'MyOtherClass *', expected 'MyClass *'}}
+ obj_c = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyClass *'}}
/* Assigning to an 'id<MyProtocol>' variable should generate a
warning if done from a 'MyClass *' (which doesn't implement
MyProtocol), but not from an 'id' or from a 'MyOtherClass *'
(which implements MyProtocol). */
obj_p = obj; /* Ok */
- obj_p = obj_c; // expected-error {{incompatible types assigning 'MyClass *' to 'id<MyProtocol>'}}
+ obj_p = obj_c; // expected-error {{incompatible type assigning 'MyClass *', expected 'id<MyProtocol>'}}
obj_p = obj_cp; /* Ok */
- obj_p = obj_C; // expected-error {{incompatible types assigning 'Class' to 'id<MyProtocol>'}}
+ obj_p = obj_C; // expected-error {{incompatible type assigning 'Class', expected 'id<MyProtocol>'}}
/* Assigning to a 'MyOtherClass *' variable should always generate
a warning, unless done from an 'id' or an 'id<MyProtocol>' (since
MyOtherClass implements MyProtocol). */
obj_cp = obj; /* Ok */
- obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *' to 'MyOtherClass *'}}
+ obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'MyOtherClass *'}}
obj_cp = obj_p; /* Ok */
- obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning 'Class' to 'MyOtherClass *'}}
+ obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyOtherClass *'}}
/* Any comparison involving an 'id' must be without warnings. */
if (obj == obj_p) foo() ; /* Ok */ /*Bogus warning here in 2.95.4*/
diff --git a/test/Sema/objc-comptypes-3.m b/test/Sema/objc-comptypes-3.m
index c7c4cab711..4aab2d2ee7 100644
--- a/test/Sema/objc-comptypes-3.m
+++ b/test/Sema/objc-comptypes-3.m
@@ -24,21 +24,21 @@ int main()
id<MyProtocolAB> obj_ab = nil;
id<MyProtocolAC> obj_ac = nil;
- obj_a = obj_b; // expected-error {{incompatible types assigning 'id<MyProtocolB>' to 'id<MyProtocolA>'}}
+ obj_a = obj_b; // expected-error {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolA>'}}
obj_a = obj_ab; /* Ok */
obj_a = obj_ac; /* Ok */
- obj_b = obj_a; // expected-error {{incompatible types assigning 'id<MyProtocolA>' to 'id<MyProtocolB>'}}
+ obj_b = obj_a; // expected-error {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolB>'}}
obj_b = obj_ab; /* Ok */
- obj_b = obj_ac; // expected-error {{incompatible types assigning 'id<MyProtocolAC>' to 'id<MyProtocolB>'}}
+ obj_b = obj_ac; // expected-error {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolB>'}}
- obj_ab = obj_a; // expected-error {{incompatible types assigning 'id<MyProtocolA>' to 'id<MyProtocolAB>'}}
- obj_ab = obj_b; // expected-error {{incompatible types assigning 'id<MyProtocolB>' to 'id<MyProtocolAB>'}}
- obj_ab = obj_ac; // expected-error {{incompatible types assigning 'id<MyProtocolAC>' to 'id<MyProtocolAB>'}}
+ obj_ab = obj_a; // expected-error {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAB>'}}
+ obj_ab = obj_b; // expected-error {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAB>'}}
+ obj_ab = obj_ac; // expected-error {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolAB>'}}
- obj_ac = obj_a; // expected-error {{incompatible types assigning 'id<MyProtocolA>' to 'id<MyProtocolAC>'}}
- obj_ac = obj_b; // expected-error {{incompatible types assigning 'id<MyProtocolB>' to 'id<MyProtocolAC>'}}
- obj_ac = obj_ab; // expected-error {{incompatible types assigning 'id<MyProtocolAB>' to 'id<MyProtocolAC>'}}
+ obj_ac = obj_a; // expected-error {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAC>'}}
+ obj_ac = obj_b; // expected-error {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAC>'}}
+ obj_ac = obj_ab; // expected-error {{incompatible type assigning 'id<MyProtocolAB>', expected 'id<MyProtocolAC>'}}
if (obj_a == obj_b) foo (); // expected-error {{invalid operands to binary expression ('id<MyProtocolA>' and 'id<MyProtocolB>')}}
if (obj_b == obj_a) foo (); // expected-error {{invalid operands to binary expression ('id<MyProtocolB>' and 'id<MyProtocolA>')}}
diff --git a/test/Sema/objc-comptypes-5.m b/test/Sema/objc-comptypes-5.m
index 646c6e58bc..508c25f01d 100644
--- a/test/Sema/objc-comptypes-5.m
+++ b/test/Sema/objc-comptypes-5.m
@@ -23,8 +23,8 @@ int main()
MyClass *obj_c_cat_p = nil;
MyOtherClass *obj_c_super_p = nil;
- obj_c_cat_p = obj_id_p; // expected-error {{incompatible types assigning 'id<MyProtocol>' to 'MyClass *'}}
- obj_c_super_p = obj_id_p; // expected-error {{incompatible types assigning 'id<MyProtocol>' to 'MyOtherClass *'}}
+ obj_c_cat_p = obj_id_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'MyClass *'}}
+ obj_c_super_p = obj_id_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'MyOtherClass *'}}
obj_id_p = obj_c_cat_p; /* Ok */
obj_id_p = obj_c_super_p; /* Ok */
diff --git a/test/Sema/objc-comptypes-6.m b/test/Sema/objc-comptypes-6.m
index ca2b131fc9..dd9b396787 100644
--- a/test/Sema/objc-comptypes-6.m
+++ b/test/Sema/objc-comptypes-6.m
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -verify -pedantic %s
#include <objc/Object.h>
@@ -9,7 +9,7 @@ extern Object* foo(void);
static Derived *test(void)
{
- Derived *m = foo(); // expected-warning {{incompatible pointer types assigning 'Object *' to 'Derived *'}}
+ Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Object *', expected 'Derived *'}}
return m;
}
diff --git a/test/Sema/objc-comptypes-7.m b/test/Sema/objc-comptypes-7.m
index e4c949ac71..9d8f211da6 100644
--- a/test/Sema/objc-comptypes-7.m
+++ b/test/Sema/objc-comptypes-7.m
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -verify -pedantic %s
#include <objc/objc.h>
@@ -23,27 +23,27 @@ int main()
/* These should all generate warnings. */
- obj = i; // expected-warning {{incompatible types assigning 'int' to 'id'}}
- obj = j; // expected-warning {{incompatible pointer types assigning 'int *' to 'id'}}
+ obj = i; // expected-warning {{incompatible pointer/int conversion assigning 'int', expected 'id'}}
+ obj = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id'}}
- obj_p = i; // expected-error {{incompatible types assigning 'int' to 'id<MyProtocol>' }}
- obj_p = j; // expected-error {{incompatible types assigning 'int *' to 'id<MyProtocol>'}}
+ obj_p = i; // expected-error {{incompatible type assigning 'int', expected 'id<MyProtocol>' }}
+ obj_p = j; // expected-error {{incompatible type assigning 'int *', expected 'id<MyProtocol>'}}
- obj_c = i; // expected-warning {{incompatible types assigning 'int' to 'MyClass *'}}
- obj_c = j; // expected-warning {{incompatible pointer types assigning 'int *' to 'MyClass *'}}
+ obj_c = i; // expected-warning {{incompatible pointer/int conversion assigning 'int', expected 'MyClass *'}}
+ obj_c = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'MyClass *'}}
- obj_C = i; // expected-warning {{incompatible types assigning 'int' to 'Class'}}
- obj_C = j; // expected-warning {{incompatible pointer types assigning 'int *' to 'Class'}}
+ obj_C = i; // expected-warning {{incompatible pointer/int conversion assigning 'int', expected 'Class'}}
+ obj_C = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'Class'}}
- i = obj; // expected-warning {{incompatible types assigning 'id' to 'int'}}
- i = obj_p; // expected-error {{incompatible types assigning 'id<MyProtocol>' to 'int'}}
- i = obj_c; // expected-warning {{incompatible types assigning 'MyClass *' to 'int'}}
- i = obj_C; // expected-warning {{incompatible types assigning 'Class' to 'int'}}
+ i = obj; // expected-warning {{incompatible pointer/int conversion assigning 'id', expected 'int'}}
+ i = obj_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'int'}}
+ i = obj_c; // expected-warning {{incompatible pointer/int conversion assigning 'MyClass *', expected 'int'}}
+ i = obj_C; // expected-warning {{incompatible pointer/int conversion assigning 'Class', expected 'int'}}
- j = obj; // expected-warning {{incompatible pointer types assigning 'id' to 'int *'}}
- j = obj_p; // expected-error {{incompatible types assigning 'id<MyProtocol>' to 'int *'}}
- j = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *' to 'int *'}}
- j = obj_C; // expected-warning {{incompatible pointer types assigning 'Class' to 'int *'}}
+ j = obj; // expected-warning {{incompatible pointer types assigning 'id', expected 'int *'}}
+ j = obj_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'int *'}}
+ j = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'int *'}}
+ j = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'int *'}}
if (obj == i) foo() ; // expected-warning {{comparison between pointer and integer ('id' and 'int')}}
if (i == obj) foo() ; // expected-warning {{comparison between pointer and integer ('int' and 'id')}}
diff --git a/test/Sema/protocol-id-test-3.m b/test/Sema/protocol-id-test-3.m
index 058be26603..8c2beee989 100644
--- a/test/Sema/protocol-id-test-3.m
+++ b/test/Sema/protocol-id-test-3.m
@@ -29,7 +29,7 @@ id<MyProto1> Func(INTF <MyProto1, MyProto2> *p2)
id<MyProto1, MyProto2> Gunc2(id <MyProto1>p2)
{
- Func(p2); // expected-error {{incompatible types passing 'id<MyProto1>' to function expecting 'INTF<MyProto1,MyProto2> *'}}
+ Func(p2); // expected-error {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
return p2; // expected-error {{incompatible type returning 'id<MyProto1>', expected 'id<MyProto1,MyProto2>'}}
}
@@ -61,7 +61,7 @@ INTF<MyProto1> * Hunc1(id <MyProto1, MyProto2>p2)
INTF<MyProto1, MyProto2> * Hunc2(id <MyProto1>p2)
{
- Func(p2); // expected-error {{incompatible types passing 'id<MyProto1>' to function expecting 'INTF<MyProto1,MyProto2> *'}}
+ Func(p2); // expected-error {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
return p2; // expected-error {{incompatible type returning 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
}
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index 9647c74702..72d3b41dbd 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -5,10 +5,10 @@ typedef int int4 __attribute__((vector_size(16)));
typedef int4* int4p;
void test1(float4 a, int4 *result, int i) {
- result[i] = a; // expected-error {{assigning 'float4' to 'int4'}}
+ result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
}
void test2(float4 a, int4p result, int i) {
- result[i] = a; // expected-error {{assigning 'float4' to 'int4'}}
+ result[i] = a; // expected-error {{assigning 'float4', expected 'int4'}}
}
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c
index ff644229d2..6f681813bc 100644
--- a/test/Sema/vector-assign.c
+++ b/test/Sema/vector-assign.c
@@ -13,27 +13,27 @@ void f() {
v4ss v5;
v1 = v2;
- v1 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2s'}}
- v1 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v2s'}}
+ v1 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2s'}}
+ v1 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v2s'}}
v1 = v5;
v2 = v1;
- v2 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2u'}}
- v2 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v2u'}}
+ v2 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2u'}}
+ v2 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v2u'}}
v2 = v5;
- v3 = v1; // expected-error {{incompatible types assigning 'v2s' to 'v1s'}}
- v3 = v2; // expected-error {{incompatible types assigning 'v2u' to 'v1s'}}
- v3 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v1s'}}
- v3 = v5; // expected-error {{incompatible types assigning 'v4ss' to 'v1s'}}
+ v3 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v1s'}}
+ v3 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v1s'}}
+ v3 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v1s'}}
+ v3 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v1s'}}
- v4 = v1; // expected-error {{incompatible types assigning 'v2s' to 'v2f'}}
- v4 = v2; // expected-error {{incompatible types assigning 'v2u' to 'v2f'}}
- v4 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v2f'}}
- v4 = v5; // expected-error {{incompatible types assigning 'v4ss' to 'v2f'}}
+ v4 = v1; // expected-error {{incompatible type assigning 'v2s', expected 'v2f'}}
+ v4 = v2; // expected-error {{incompatible type assigning 'v2u', expected 'v2f'}}
+ v4 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v2f'}}
+ v4 = v5; // expected-error {{incompatible type assigning 'v4ss', expected 'v2f'}}
v5 = v1;
v5 = v2;
- v5 = v3; // expected-error {{incompatible types assigning 'v1s' to 'v4ss'}}
- v5 = v4; // expected-error {{incompatible types assigning 'v2f' to 'v4ss'}}
+ v5 = v3; // expected-error {{incompatible type assigning 'v1s', expected 'v4ss'}}
+ v5 = v4; // expected-error {{incompatible type assigning 'v2f', expected 'v4ss'}}
}