Patchwork ObjC/ObjC++ - testcase merge

login
register
mail settings
Submitter Nicola Pero
Date Oct. 18, 2010, 11:32 p.m.
Message ID <1287444736.85096991@192.168.2.229>
Download mbox | patch
Permalink /patch/68252/
State New
Headers show

Comments

Nicola Pero - Oct. 18, 2010, 11:32 p.m.
This patch merges two testcases from the FSF apple/trunk.  They already seem 
to work fine, but it's good to have them. :-)

Committed to trunk (preapproved by Mike).

Thanks

Patch

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 165657)
+++ ChangeLog   (working copy)
@@ -2,6 +2,16 @@ 
        
        Merge from 'apple/trunk' branch on FSF servers.
 
+       2006-03-16 Fariborz Jahanian <fjahanian@apple.com>
+
+        Radar 4293709
+       * objc.dg/proto-init-mimatch-1.m: New.
+       * obj-c++.dg/proto-init-mimatch-1.mm: New.
+
+2010-10-18  Nicola Pero  <nicola.pero@meta-innovation.com>
+       
+       Merge from 'apple/trunk' branch on FSF servers.
+
        2006-01-17  Fariborz Jahanian <fjahanian@apple.com>
 
        Radar 4407151
Index: objc.dg/proto-init-mimatch-1.m
===================================================================
--- objc.dg/proto-init-mimatch-1.m      (revision 0)
+++ objc.dg/proto-init-mimatch-1.m      (revision 0)
@@ -0,0 +1,35 @@ 
+/* Test to warn on protocol mismatch in a variety of initializations. */
+
+/* { dg-do compile } */
+
+typedef struct objc_class *Class;
+
+typedef struct objc_object {
+        Class isa;
+} *id;
+
+@protocol NSObject
+@end
+
+@interface NSObject <NSObject> 
+@end
+
+@protocol NSCopying
+- (void)copyWithZone;
+@end
+
+@interface Foo:NSObject <NSCopying> 
+@end
+
+
+extern id <NSObject> NSCopyObject();
+
+@implementation Foo
+- (void)copyWithZone {
+    Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+
+    Foo<NSObject,NSCopying> *g = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+
+    id<NSObject,NSCopying> h = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+}
+@end   
Index: obj-c++.dg/proto-init-mimatch-1.mm
===================================================================
--- obj-c++.dg/proto-init-mimatch-1.mm  (revision 0)
+++ obj-c++.dg/proto-init-mimatch-1.mm  (revision 0)
@@ -0,0 +1,35 @@ 
+/* Test to warn on protocol mismatch in a variety of initializations. */
+
+/* { dg-do compile } */
+
+typedef struct objc_class *Class;
+
+typedef struct objc_object {
+        Class isa;
+} *id;
+
+@protocol NSObject
+@end
+
+@interface NSObject <NSObject> 
+@end
+
+@protocol NSCopying
+- (void)copyWithZone;
+@end
+
+@interface Foo:NSObject <NSCopying> 
+@end
+
+
+extern id <NSObject> NSCopyObject();
+
+@implementation Foo
+- (void)copyWithZone {
+    Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+
+    Foo<NSObject,NSCopying> *g = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+
+    id<NSObject,NSCopying> h = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
+}
+@end