diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-04-09 00:35:39 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-04-09 00:35:39 +0000 |
| commit | c68e140657e40cda2f027beff923276b36e33684 (patch) | |
| tree | 1a32c9fcccd9102ab6ca64a098c771ec4ebea5a6 /clang/test/SemaObjC | |
| parent | 48b1804e7957ce379441e477602ac860a606e469 (diff) | |
| download | bcm5719-llvm-c68e140657e40cda2f027beff923276b36e33684.tar.gz bcm5719-llvm-c68e140657e40cda2f027beff923276b36e33684.zip | |
Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as
t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
expected 'char *' [-pedantic]
char *name = __func__;
^ ~~~~~~~~
We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:
t.c:2:9: warning: initializing 'char *' from an expression of type
'char const [2]' discards qualifiers [-pedantic]
char *name = __func__;
^ ~~~~~~~~
Fixes <rdar://problem/7447179>.
llvm-svn: 100832
Diffstat (limited to 'clang/test/SemaObjC')
23 files changed, 77 insertions, 77 deletions
diff --git a/clang/test/SemaObjC/argument-checking.m b/clang/test/SemaObjC/argument-checking.m index 3806a4c9653..19caf3271c6 100644 --- a/clang/test/SemaObjC/argument-checking.m +++ b/clang/test/SemaObjC/argument-checking.m @@ -16,10 +16,10 @@ void test() { id obj = [Test alloc]; struct S sInst; - charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int', expected 'char *'}} - charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]', expected 'char'}} + charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int' to parameter of type 'char *'}} + charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]' to parameter of type 'char'}} [obj charStarMeth:1]; // expected-warning {{incompatible integer to pointer conversion sending 'int'}} - [obj structMeth:1]; // expected-error {{incompatible type sending 'int'}} - [obj structMeth:sInst :1]; // expected-error {{incompatible type sending 'int'}} + [obj structMeth:1]; // expected-error {{sending 'int'}} + [obj structMeth:sInst :1]; // expected-error {{sending 'int'}} } diff --git a/clang/test/SemaObjC/block-type-safety.m b/clang/test/SemaObjC/block-type-safety.m index 0df8c675ed9..2b31cacd73c 100644 --- a/clang/test/SemaObjC/block-type-safety.m +++ b/clang/test/SemaObjC/block-type-safety.m @@ -29,14 +29,14 @@ void r2 (id<NSObject> (^f) (void)) { } void test1() { - f2(^(Sub *o) { }); // expected-error {{incompatible block pointer types passing 'void (^)(Sub *)', expected 'void (^)(Super *)'}} + f2(^(Sub *o) { }); // expected-error {{incompatible block pointer types passing}} f3(^(Super *o) { }); // OK, block taking Super* may be called with a Sub* r0(^Super* () { return 0; }); // OK r0(^Sub* () { return 0; }); // OK, variable of type Super* gets return value of type Sub* r0(^id () { return 0; }); - r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing 'Super *(^)(void)', expected 'Sub *(^)()'}} + r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing}} r1(^Sub* () { return 0; }); // OK r1(^id () { return 0; }); @@ -97,10 +97,10 @@ void test2(void) @protocol P, P2; void f4(void (^f)(id<P> x)) { NSArray<P2> *b; - f(b); // expected-warning {{incompatible type passing 'NSArray<P2> *', expected 'id<P>'}} + f(b); // expected-warning {{passing 'NSArray<P2> *' to parameter of incompatible type 'id<P>'}} } void test3() { - f4(^(NSArray<P2>* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)', expected 'void (^)(id<P>)'}} + f4(^(NSArray<P2>* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)' to parameter of type 'void (^)(id<P>)'}} } diff --git a/clang/test/SemaObjC/blocks.m b/clang/test/SemaObjC/blocks.m index afa3bdf071b..10239e5488d 100644 --- a/clang/test/SemaObjC/blocks.m +++ b/clang/test/SemaObjC/blocks.m @@ -23,7 +23,7 @@ void foo4(id (^objectCreationBlock)(int)) { void bar5(id(^)(void)); void foo5(id (^objectCreationBlock)(int)) { - return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)(void)'}} + return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)' to parameter of type 'id (^)(void)'}} } void bar6(id(^)(int)); diff --git a/clang/test/SemaObjC/class-method-self.m b/clang/test/SemaObjC/class-method-self.m index 6f7d1fd93f4..ec0edf12008 100644 --- a/clang/test/SemaObjC/class-method-self.m +++ b/clang/test/SemaObjC/class-method-self.m @@ -18,9 +18,9 @@ typedef struct objc_class *Class; static XX *obj; + (void)classMethod { - [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}} + [obj addObserver:self]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} Class whatever; - [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}} + [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}} } @end diff --git a/clang/test/SemaObjC/compatible-protocol-qualified-types.m b/clang/test/SemaObjC/compatible-protocol-qualified-types.m index 0df905c9ca1..1c9cc2c4947 100644 --- a/clang/test/SemaObjC/compatible-protocol-qualified-types.m +++ b/clang/test/SemaObjC/compatible-protocol-qualified-types.m @@ -69,7 +69,7 @@ extern NSString * const XCActiveSelectionLevel; - (NSTextStorage *)contents { - [_contents setDelegate:self]; // expected-warning {{incompatible type sending 'SKTText *', expected 'id<NSTextStorageDelegate>'}} + [_contents setDelegate:self]; // expected-warning {{sending 'SKTText *' to parameter of incompatible type 'id<NSTextStorageDelegate>'}} return 0; } diff --git a/clang/test/SemaObjC/comptypes-1.m b/clang/test/SemaObjC/comptypes-1.m index 5b1891d4af2..98107eef215 100644 --- a/clang/test/SemaObjC/comptypes-1.m +++ b/clang/test/SemaObjC/comptypes-1.m @@ -34,25 +34,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 *', expected 'MyClass *'}} - obj_c = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyClass *'}} + obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'MyOtherClass *'}} + obj_c = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'Class'}} /* 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-warning {{incompatible type assigning 'MyClass *', expected 'id<MyProtocol>'}} + obj_p = obj_c; // expected-warning {{ assigning to 'id<MyProtocol>' from incompatible type 'MyClass *'}} obj_p = obj_cp; /* Ok */ - obj_p = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<MyProtocol>'}} + obj_p = obj_C; // expected-warning {{incompatible pointer types assigning to 'id<MyProtocol>' from 'Class'}} /* 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 *', expected 'MyOtherClass *'}} + obj_cp = obj_c; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'MyClass *'}} obj_cp = obj_p; /* Ok */ - obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyOtherClass *'}} + obj_cp = obj_C; // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}} /* 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/clang/test/SemaObjC/comptypes-3.m b/clang/test/SemaObjC/comptypes-3.m index 94171d11d56..6c1ce419b62 100644 --- a/clang/test/SemaObjC/comptypes-3.m +++ b/clang/test/SemaObjC/comptypes-3.m @@ -26,21 +26,21 @@ int main() id<MyProtocolAB> obj_ab = nil; id<MyProtocolAC> obj_ac = nil; - obj_a = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolA>'}} + obj_a = obj_b; // expected-warning {{assigning to 'id<MyProtocolA>' from incompatible type 'id<MyProtocolB>'}} obj_a = obj_ab; /* Ok */ obj_a = obj_ac; /* Ok */ - obj_b = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolB>'}} + obj_b = obj_a; // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolA>'}} obj_b = obj_ab; /* Ok */ - obj_b = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolB>'}} + obj_b = obj_ac; // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolAC>'}} - obj_ab = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAB>'}} - obj_ab = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAB>'}} - obj_ab = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolAB>'}} + obj_ab = obj_a; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolA>'}} + obj_ab = obj_b; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolB>'}} + obj_ab = obj_ac; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolAC>'}} - obj_ac = obj_a; // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAC>'}} - obj_ac = obj_b; // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAC>'}} - obj_ac = obj_ab; // expected-warning {{incompatible type assigning 'id<MyProtocolAB>', expected 'id<MyProtocolAC>'}} + obj_ac = obj_a; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolA>'}} + obj_ac = obj_b; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolB>'}} + obj_ac = obj_ab; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolAB>'}} if (obj_a == obj_b) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolA>' and 'id<MyProtocolB>')}} if (obj_b == obj_a) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolB>' and 'id<MyProtocolA>')}} diff --git a/clang/test/SemaObjC/comptypes-6.m b/clang/test/SemaObjC/comptypes-6.m index 2911a390ef8..cabf813679c 100644 --- a/clang/test/SemaObjC/comptypes-6.m +++ b/clang/test/SemaObjC/comptypes-6.m @@ -9,7 +9,7 @@ extern Object* foo(void); static Derived *test(void) { - Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Object *', expected 'Derived *'}} + Derived *m = foo(); // expected-warning {{incompatible pointer types initializing 'Derived *' from an expression of type 'Object *'}} return m; } diff --git a/clang/test/SemaObjC/comptypes-7.m b/clang/test/SemaObjC/comptypes-7.m index 2519c41c829..df627e5300a 100644 --- a/clang/test/SemaObjC/comptypes-7.m +++ b/clang/test/SemaObjC/comptypes-7.m @@ -24,27 +24,27 @@ int main() /* These should all generate warnings. */ - obj = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id'}} - obj = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id'}} + obj = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id' from 'int'}} + obj = j; // expected-warning {{incompatible pointer types assigning to 'id' from 'int *'}} - obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id<MyProtocol>'}} - obj_p = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id<MyProtocol>'}} + obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id<MyProtocol>' from 'int'}} + obj_p = j; // expected-warning {{ incompatible pointer types assigning to 'id<MyProtocol>' from 'int *'}} - obj_c = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'MyClass *'}} - obj_c = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'MyClass *'}} + obj_c = i; // expected-warning {{ incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}} + obj_c = j; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'int *'}} - obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'Class'}} - obj_C = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'Class'}} + obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'Class' from 'int'}} + obj_C = j; // expected-warning {{incompatible pointer types assigning to 'Class' from 'int *'}} - i = obj; // expected-warning {{incompatible pointer to integer conversion assigning 'id', expected 'int'}} - i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning 'id<MyProtocol>', expected 'int'}} - i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning 'MyClass *', expected 'int'}} - i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning 'Class', expected 'int'}} + i = obj; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id'}} + i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id<MyProtocol>'}} + i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'MyClass *'}} + i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'Class'}} - j = obj; // expected-warning {{incompatible pointer types assigning 'id', expected 'int *'}} - j = obj_p; // expected-warning {{incompatible pointer types 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 *'}} + j = obj; // expected-warning {{incompatible pointer types assigning to 'int *' from 'id'}} + j = obj_p; // expected-warning {{ incompatible pointer types assigning to 'int *' from 'id<MyProtocol>'}} + j = obj_c; // expected-warning {{incompatible pointer types assigning to 'int *' from 'MyClass *'}} + j = obj_C; // expected-warning {{incompatible pointer types assigning to 'int *' from 'Class'}} 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/clang/test/SemaObjC/comptypes-legal.m b/clang/test/SemaObjC/comptypes-legal.m index 8caf18563b0..e318d332f36 100644 --- a/clang/test/SemaObjC/comptypes-legal.m +++ b/clang/test/SemaObjC/comptypes-legal.m @@ -33,5 +33,5 @@ void foo(void) { // GCC currently allows this (it has some fiarly new support for covariant return types and contravariant argument types). // Since registerFunc: expects a Derived object as it's second argument, I don't know why this would be legal. - [Derived registerFunc: ExternFunc]; // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)', expected 'FuncSignature *'}} + [Derived registerFunc: ExternFunc]; // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)' to parameter of type 'FuncSignature *'}} } diff --git a/clang/test/SemaObjC/conditional-expr-2.m b/clang/test/SemaObjC/conditional-expr-2.m index e97b693dfc5..fdf3d1381a8 100644 --- a/clang/test/SemaObjC/conditional-expr-2.m +++ b/clang/test/SemaObjC/conditional-expr-2.m @@ -25,5 +25,5 @@ void foo (int i, NSKey *NSKeyValueCoding_NullValue, UpdatesList *nukedUpdatesLis obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}} key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}} key = i ? NSKeyValueCoding_NullValue : keysub; - keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning 'NSKey *', expected 'KeySub *'}} + keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}} } diff --git a/clang/test/SemaObjC/conditional-expr-3.m b/clang/test/SemaObjC/conditional-expr-3.m index 312f77a15ff..9f34ca0e697 100644 --- a/clang/test/SemaObjC/conditional-expr-3.m +++ b/clang/test/SemaObjC/conditional-expr-3.m @@ -27,11 +27,11 @@ void f1(id x, A *a) { } void f2(id<P1> x) { - id<P0> l = x; // expected-warning {{incompatible type initializing 'id<P1>', expected 'id<P0>'}} + id<P0> l = x; // expected-warning {{initializing 'id<P0>' from an expression of incompatible type 'id<P1>'}} } void f3(A *a) { - id<P1> l = a; // expected-warning {{incompatible type initializing 'A *', expected 'id<P1>'}} + id<P1> l = a; // expected-warning {{ initializing 'id<P1>' from an expression of incompatible type 'A *'}} } void f4(int cond, id x, A *a) { diff --git a/clang/test/SemaObjC/conditional-expr-4.m b/clang/test/SemaObjC/conditional-expr-4.m index 84652e4513d..944c1753dd2 100644 --- a/clang/test/SemaObjC/conditional-expr-4.m +++ b/clang/test/SemaObjC/conditional-expr-4.m @@ -26,7 +26,7 @@ A *f1_a(int cond, A *a) { } void *f1_const_a(int x, void *p, const A * q) { - void *r = x ? p : q; // expected-warning{{initializing 'void const *' discards qualifiers, expected 'void *'}} + void *r = x ? p : q; // expected-warning{{initializing 'void *' from an expression of type 'void const *' discards qualifiers}} return r; } diff --git a/clang/test/SemaObjC/conditional-expr.m b/clang/test/SemaObjC/conditional-expr.m index 1436f7ee0e0..74ab59bdb9e 100644 --- a/clang/test/SemaObjC/conditional-expr.m +++ b/clang/test/SemaObjC/conditional-expr.m @@ -27,7 +27,7 @@ @implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}} - (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream { id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; - self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}} + self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream2 *' from incompatible type 'id<DTOutputStreams>'}} return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream2 *')}} } @end @@ -36,7 +36,7 @@ @implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}} - (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream { id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{method '-nextOutputStream' not found (return type defaults to 'id')}} - self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}} + self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream3 *' from incompatible type 'id<DTOutputStreams>'}} return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream3 *')}} } @end diff --git a/clang/test/SemaObjC/id.m b/clang/test/SemaObjC/id.m index 206127a5cce..27b84dedf8e 100644 --- a/clang/test/SemaObjC/id.m +++ b/clang/test/SemaObjC/id.m @@ -9,8 +9,8 @@ void foo() { // Test assignment compatibility of Class and id. No warning should be // produced. // rdar://6770142 - Class and id<foo> are compatible. - S = T; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<Foo>'}} - T = S; // expected-warning {{incompatible pointer types assigning 'id<Foo>', expected 'Class'}} + S = T; // expected-warning {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}} + T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}} R = T; T = R; R = S; S = R; } diff --git a/clang/test/SemaObjC/incompatible-protocol-qualified-types.m b/clang/test/SemaObjC/incompatible-protocol-qualified-types.m index 7eb540ad556..23cb50a3629 100644 --- a/clang/test/SemaObjC/incompatible-protocol-qualified-types.m +++ b/clang/test/SemaObjC/incompatible-protocol-qualified-types.m @@ -21,15 +21,15 @@ INTF <MyProto1> * Func1(INTF <MyProto1, MyProto2> *p2) INTF <MyProto1, MyProto2> * Func2(INTF <MyProto1> *p2) { - 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> *}} + Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *' to parameter of type 'INTF<MyProto1,MyProto2> *'}} + return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *' from a function with result type 'INTF<MyProto1,MyProto2> *'}} } INTF <MyProto1> * Func3(INTF <MyProto2> *p2) { - return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *', expected 'INTF<MyProto1> *}} + return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *' from a function with result type 'INTF<MyProto1> *'}} } diff --git a/clang/test/SemaObjC/message.m b/clang/test/SemaObjC/message.m index 57b10979625..fc4bfcc95c0 100644 --- a/clang/test/SemaObjC/message.m +++ b/clang/test/SemaObjC/message.m @@ -87,7 +87,7 @@ struct S { int X; } S; int test5(int X) { int a = [X somemsg]; // expected-warning {{receiver type 'int' is not 'id'}} \ expected-warning {{method '-somemsg' not found}} \ - expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}} + expected-warning {{incompatible pointer to integer conversion initializing 'int' from an expression of type 'id'}} int b = [S somemsg]; // expected-error {{bad receiver type 'struct S'}} } diff --git a/clang/test/SemaObjC/method-arg-qualifier-warning.m b/clang/test/SemaObjC/method-arg-qualifier-warning.m index 397f24135f5..a064a7d7a55 100644 --- a/clang/test/SemaObjC/method-arg-qualifier-warning.m +++ b/clang/test/SemaObjC/method-arg-qualifier-warning.m @@ -12,8 +12,8 @@ static NSString * const Identifier3 = @"Identifier3"; int main () { - [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}} - [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}} + [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}} + [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}} [@"Identifier3" isEqualToString:Identifier3]; return 0; } diff --git a/clang/test/SemaObjC/protocol-id-test-3.m b/clang/test/SemaObjC/protocol-id-test-3.m index 3538b0e05e3..89f11c3d75f 100644 --- a/clang/test/SemaObjC/protocol-id-test-3.m +++ b/clang/test/SemaObjC/protocol-id-test-3.m @@ -29,15 +29,15 @@ id<MyProto1> Func(INTF <MyProto1, MyProto2> *p2) id<MyProto1, MyProto2> Gunc2(id <MyProto1>p2) { - Func(p2); // expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}} - return p2; // expected-warning {{incompatible type returning 'id<MyProto1>', expected 'id<MyProto1,MyProto2>'}} + Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}} + return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'id<MyProto1,MyProto2>'}} } id<MyProto1> Gunc3(id <MyProto2>p2) { - return p2; // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'id<MyProto1>'}} + return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'id<MyProto1>'}} } @@ -61,13 +61,13 @@ INTF<MyProto1> * Hunc1(id <MyProto1, MyProto2>p2) INTF<MyProto1, MyProto2> * Hunc2(id <MyProto1>p2) { - Func(p2); // expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}} - return p2; // expected-warning {{incompatible type returning 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}} + Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}} + return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'INTF<MyProto1,MyProto2> *'}} } INTF<MyProto1> * Hunc3(id <MyProto2>p2) { - return p2; // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'INTF<MyProto1> *'}} + return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'INTF<MyProto1> *'}} } diff --git a/clang/test/SemaObjC/protocol-typecheck.m b/clang/test/SemaObjC/protocol-typecheck.m index d9cde87d4c2..3d98df8aaba 100644 --- a/clang/test/SemaObjC/protocol-typecheck.m +++ b/clang/test/SemaObjC/protocol-typecheck.m @@ -20,6 +20,6 @@ void func() { [obj setFlexElement:flexer]; // FIXME: GCC provides the following diagnostic (which is much better): // protocol-typecheck.m:21: warning: class 'NSObject <PWhatever, XCElementP>' does not implement the 'XCElementSpacerP' protocol - [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *', expected 'NSObject<PWhatever,XCElementSpacerP> *'}} + [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *' to parameter of type 'NSObject<PWhatever,XCElementSpacerP> *'}} } diff --git a/clang/test/SemaObjC/protocol-warn.m b/clang/test/SemaObjC/protocol-warn.m index d0c51e3ffab..2d042380582 100644 --- a/clang/test/SemaObjC/protocol-warn.m +++ b/clang/test/SemaObjC/protocol-warn.m @@ -51,5 +51,5 @@ UIWebPDFView *getView() { UIWebBrowserView *browserView; UIWebPDFView *pdfView; - return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *', expected 'UIWebPDFView *'}} + return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *' from a function with result type 'UIWebPDFView *'}} } diff --git a/clang/test/SemaObjC/warn-incompatible-builtin-types.m b/clang/test/SemaObjC/warn-incompatible-builtin-types.m index 2a5005a3960..8806d63baa3 100644 --- a/clang/test/SemaObjC/warn-incompatible-builtin-types.m +++ b/clang/test/SemaObjC/warn-incompatible-builtin-types.m @@ -10,8 +10,8 @@ void FUNC() { SEL s1, s2; id i, i1; Foo *f; - [f foo:f]; // expected-warning {{incompatible pointer types sending 'Foo *', expected 'Class'}} - c = f; // expected-warning {{incompatible pointer types assigning 'Foo *', expected 'Class'}} + [f foo:f]; // expected-warning {{incompatible pointer types sending 'Foo *' to parameter of type 'Class'}} + c = f; // expected-warning {{incompatible pointer types assigning to 'Class' from 'Foo *'}} c = i; @@ -21,22 +21,22 @@ void FUNC() { i = i1; - s1 = i; // expected-warning {{incompatible pointer types assigning 'id', expected 'SEL'}} - i = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'id'}} + s1 = i; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'id'}} + i = s1; // expected-warning {{incompatible pointer types assigning to 'id' from 'SEL'}} s1 = s2; - s1 = c; // expected-warning {{incompatible pointer types assigning 'Class', expected 'SEL'}} + s1 = c; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Class'}} - c = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'Class'}} + c = s1; // expected-warning {{incompatible pointer types assigning to 'Class' from 'SEL'}} f = i; - f = c; // expected-warning {{incompatible pointer types assigning 'Class', expected 'Foo *'}} + f = c; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'Class'}} - f = s1; // expected-warning {{incompatible pointer types assigning 'SEL', expected 'Foo *'}} + f = s1; // expected-warning {{incompatible pointer types assigning to 'Foo *' from 'SEL'}} i = f; - s1 = f; // expected-warning {{incompatible pointer types assigning 'Foo *', expected 'SEL'}} + s1 = f; // expected-warning {{incompatible pointer types assigning to 'SEL' from 'Foo *'}} } diff --git a/clang/test/SemaObjC/warn-write-strings.m b/clang/test/SemaObjC/warn-write-strings.m index 938f0be7721..c0b77411250 100644 --- a/clang/test/SemaObjC/warn-write-strings.m +++ b/clang/test/SemaObjC/warn-write-strings.m @@ -1,4 +1,4 @@ // RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s // PR4804 -char* x = "foo"; // expected-warning {{initializing 'char const [4]' discards qualifiers, expected 'char *'}} +char* x = "foo"; // expected-warning {{initializing 'char *' from an expression of type 'char const [4]' discards qualifiers}} |

