From 029b98c85fd1fed4838f3d4249aa39f9f12873e6 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Sun, 26 Dec 2010 18:05:00 +0000 Subject: [PATCH] In gcc/testsuite/: 2010-12-26 Nicola Pero In gcc/testsuite/: 2010-12-26 Nicola Pero * objc.dg/gnu-api-2-class.m: Updated the test to work with the Apple runtime as well. * obj-c++.dg/gnu-api-2-class.mm: Same change. * objc.dg/gnu-api-2-ivar.m: Same change. * obj-c++.dg/gnu-api-2-ivar.mm: Same change. * objc.dg/gnu-api-2-method.m: Same change. * obj-c++.dg/gnu-api-2-method.mm: Same change. * objc.dg/gnu-api-2-objc.m: Same change. * obj-c++.dg/gnu-api-2-objc.mm: Same change. * objc.dg/gnu-api-2-object.m: Same change. * obj-c++.dg/gnu-api-2-object.mm: Same change. * objc.dg/gnu-api-2-property.m: Same change. * obj-c++.dg/gnu-api-2-property.mm: Same change. * objc.dg/gnu-api-2-protocol.m: Same change. * obj-c++.dg/gnu-api-2-protocol.mm: Same change. * objc.dg/gnu-api-2-objc.m: Also, fixed test for objc_disposeClassPair not to create a new class pair with the same name as an existing class, and to test that the class pair is created correctly. * obj-c++.dg/gnu-api-2-objc.mm: Same change. From-SVN: r168252 --- gcc/testsuite/ChangeLog | 24 +++++++++++++++++++ gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm | 5 ++-- gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm | 3 ++- gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm | 3 ++- gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm | 8 +++++-- gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm | 3 ++- .../obj-c++.dg/gnu-api-2-property.mm | 10 +++++++- .../obj-c++.dg/gnu-api-2-protocol.mm | 7 +++--- gcc/testsuite/objc.dg/gnu-api-2-class.m | 5 ++-- gcc/testsuite/objc.dg/gnu-api-2-ivar.m | 3 ++- gcc/testsuite/objc.dg/gnu-api-2-method.m | 3 ++- gcc/testsuite/objc.dg/gnu-api-2-objc.m | 8 +++++-- gcc/testsuite/objc.dg/gnu-api-2-object.m | 3 ++- gcc/testsuite/objc.dg/gnu-api-2-property.m | 9 ++++++- gcc/testsuite/objc.dg/gnu-api-2-protocol.m | 7 +++--- 15 files changed, 79 insertions(+), 22 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c4a012b9c7c..60773fb90c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,27 @@ +2010-12-26 Nicola Pero + + * objc.dg/gnu-api-2-class.m: Updated the test to work with the + Apple runtime as well. + * obj-c++.dg/gnu-api-2-class.mm: Same change. + * objc.dg/gnu-api-2-ivar.m: Same change. + * obj-c++.dg/gnu-api-2-ivar.mm: Same change. + * objc.dg/gnu-api-2-method.m: Same change. + * obj-c++.dg/gnu-api-2-method.mm: Same change. + * objc.dg/gnu-api-2-objc.m: Same change. + * obj-c++.dg/gnu-api-2-objc.mm: Same change. + * objc.dg/gnu-api-2-object.m: Same change. + * obj-c++.dg/gnu-api-2-object.mm: Same change. + * objc.dg/gnu-api-2-property.m: Same change. + * obj-c++.dg/gnu-api-2-property.mm: Same change. + * objc.dg/gnu-api-2-protocol.m: Same change. + * obj-c++.dg/gnu-api-2-protocol.mm: Same change. + + * objc.dg/gnu-api-2-objc.m: Also, fixed test for + objc_disposeClassPair not to create a new class pair with the same + name as an existing class, and to test that the class pair is + created correctly. + * obj-c++.dg/gnu-api-2-objc.mm: Same change. + 2010-12-26 Nicola Pero * objc.dg/special/special.exp: Added load-category-2 and diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm index 18c3393fa1e..1e0aaa967e1 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm @@ -3,7 +3,6 @@ This is test 'class', covering all functions starting with 'class'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -256,7 +257,7 @@ int main () std::cout << "Testing class_copyPropertyList ()...\n"; { unsigned int count; - Property * list = class_copyPropertyList (objc_getClass ("MySubClass"), &count); + objc_property_t * list = class_copyPropertyList (objc_getClass ("MySubClass"), &count); if (count != 0 || list != NULL) abort (); diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm index a95cbac7fcc..47cc5752131 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-ivar.mm @@ -3,7 +3,6 @@ This is test 'ivar', covering all functions starting with 'ivar'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm index ea665052660..56f9f2d1557 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-method.mm @@ -3,7 +3,6 @@ This is test 'method', covering all functions starting with 'method'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm index 4761278c955..b7d4ace0070 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-objc.mm @@ -3,7 +3,6 @@ This is test 'objc', covering all functions starting with 'objc'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -103,7 +104,10 @@ int main () std::cout << "Testing objc_disposeClassPair ()...\n"; { Method method = class_getInstanceMethod (objc_getClass ("MySubClass"), @selector (setVariable:)); - Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass", 0); + Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass2", 0); + + if (new_class == Nil) + abort (); /* Add a bit of everything to the class to exercise undoing all these changes. */ diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm index 2a544474d37..219cd3d1cc5 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-object.mm @@ -3,7 +3,6 @@ This is test 'object', covering all functions starting with 'object'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm index 9907d4438f3..0279124dcc0 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-property.mm @@ -3,7 +3,6 @@ This is test 'property', covering all functions starting with 'property'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -50,15 +51,22 @@ int main () /* TODO: Test new ABI (when available). */ std::cout << "Testing property_getAttributes () ...\n"; { + /* The Apple/NeXT runtime seems to crash on the following. */ +#ifdef __GNU_LIBOBJC__ if (property_getAttributes (NULL) != NULL) abort (); +#endif } /* TODO: Test new ABI (when available). */ std::cout << "Testing property_getName () ...\n"; { + /* The Apple/NeXT runtime seems to crash on the following. */ +#ifdef __GNU_LIBOBJC__ + if (property_getName (NULL) != NULL) abort (); +#endif } return (0); diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm index 1db7d766183..b16ba5c898a 100644 --- a/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm +++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-protocol.mm @@ -3,7 +3,6 @@ This is test 'protocol', covering all functions starting with 'protocol'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -88,7 +89,7 @@ int main () std::cout << "Testing protocol_copyPropertyList ()...\n"; { unsigned int count; - Property *list; + objc_property_t *list; list = protocol_copyPropertyList (@protocol (MyProtocol), &count); @@ -136,7 +137,7 @@ int main () /* TODO: Test new ABI (when available). */ std::cout << "Testing protocol_getProperty ()...\n"; { - Property property; + objc_property_t property; property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty", YES, YES); diff --git a/gcc/testsuite/objc.dg/gnu-api-2-class.m b/gcc/testsuite/objc.dg/gnu-api-2-class.m index 3302fccbb17..2b2715ceb3d 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-class.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-class.m @@ -3,7 +3,6 @@ This is test 'class', covering all functions starting with 'class'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -256,7 +257,7 @@ int main(int argc, void **args) printf ("Testing class_copyPropertyList ()...\n"); { unsigned int count; - Property * list = class_copyPropertyList (objc_getClass ("MySubClass"), &count); + objc_property_t * list = class_copyPropertyList (objc_getClass ("MySubClass"), &count); if (count != 0 || list != NULL) abort (); diff --git a/gcc/testsuite/objc.dg/gnu-api-2-ivar.m b/gcc/testsuite/objc.dg/gnu-api-2-ivar.m index 914a439553d..484489ed75e 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-ivar.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-ivar.m @@ -3,7 +3,6 @@ This is test 'ivar', covering all functions starting with 'ivar'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/objc.dg/gnu-api-2-method.m b/gcc/testsuite/objc.dg/gnu-api-2-method.m index cfcf28a9905..a46305721f5 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-method.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-method.m @@ -3,7 +3,6 @@ This is test 'method', covering all functions starting with 'method'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/objc.dg/gnu-api-2-objc.m b/gcc/testsuite/objc.dg/gnu-api-2-objc.m index c7f3946e596..67e43c9d50b 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-objc.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-objc.m @@ -3,7 +3,6 @@ This is test 'objc', covering all functions starting with 'objc'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -103,7 +104,10 @@ int main(int argc, void **args) printf ("Testing objc_disposeClassPair ()...\n"); { Method method = class_getInstanceMethod (objc_getClass ("MySubClass"), @selector (setVariable:)); - Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass", 0); + Class new_class = objc_allocateClassPair (objc_getClass ("MyRootClass"), "MyNewSubClass2", 0); + + if (new_class == Nil) + abort (); /* Add a bit of everything to the class to exercise undoing all these changes. */ diff --git a/gcc/testsuite/objc.dg/gnu-api-2-object.m b/gcc/testsuite/objc.dg/gnu-api-2-object.m index 6068411d79b..db9576fc6fc 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-object.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-object.m @@ -3,7 +3,6 @@ This is test 'object', covering all functions starting with 'object'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol diff --git a/gcc/testsuite/objc.dg/gnu-api-2-property.m b/gcc/testsuite/objc.dg/gnu-api-2-property.m index 974ab6c80b8..8ac34e981f1 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-property.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-property.m @@ -3,7 +3,6 @@ This is test 'property', covering all functions starting with 'property'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -50,15 +51,21 @@ int main(int argc, void **args) /* TODO: Test new ABI (when available). */ printf ("Testing property_getAttributes () ...\n"); { + /* The Apple/NeXT runtime seems to crash on the following. */ +#ifdef __GNU_LIBOBJC__ if (property_getAttributes (NULL) != NULL) abort (); +#endif } /* TODO: Test new ABI (when available). */ printf ("Testing property_getName () ...\n"); { + /* The Apple/NeXT runtime seems to crash on the following. */ +#ifdef __GNU_LIBOBJC__ if (property_getName (NULL) != NULL) abort (); +#endif } return 0; diff --git a/gcc/testsuite/objc.dg/gnu-api-2-protocol.m b/gcc/testsuite/objc.dg/gnu-api-2-protocol.m index 537e5dfbc7d..84aca5d2c95 100644 --- a/gcc/testsuite/objc.dg/gnu-api-2-protocol.m +++ b/gcc/testsuite/objc.dg/gnu-api-2-protocol.m @@ -3,7 +3,6 @@ This is test 'protocol', covering all functions starting with 'protocol'. */ /* { dg-do run } */ -/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */ /* To get the modern GNU Objective-C Runtime API, you include objc/runtime.h. */ @@ -16,11 +15,13 @@ { Class isa; } + alloc; - init; ++ initialize; @end @implementation MyRootClass + alloc { return class_createInstance (self, 0); } - init { return self; } ++ initialize { return self; } @end @protocol MyProtocol @@ -88,7 +89,7 @@ int main(int argc, void **args) printf ("Testing protocol_copyPropertyList ()...\n"); { unsigned int count; - Property *list; + objc_property_t *list; list = protocol_copyPropertyList (@protocol (MyProtocol), &count); @@ -136,7 +137,7 @@ int main(int argc, void **args) /* TODO: Test new ABI (when available). */ printf ("Testing protocol_getProperty ()...\n"); { - Property property; + objc_property_t property; property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty", YES, YES); -- 2.30.2