Commit 029b98c8 by Nicola Pero Committed by Nicola Pero

In gcc/testsuite/: 2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com>

In gcc/testsuite/:
2010-12-26  Nicola Pero  <nicola.pero@meta-innovation.com>

	* 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
parent fa539f51
2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com> 2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com>
* 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 <nicola.pero@meta-innovation.com>
* objc.dg/special/special.exp: Added load-category-2 and * objc.dg/special/special.exp: Added load-category-2 and
load-category-3 tests. load-category-3 tests.
* objc.dg/special/load-category-2.h: New. * objc.dg/special/load-category-2.h: New.
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'class', covering all functions starting with 'class'. */ This is test 'class', covering all functions starting with 'class'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -256,7 +257,7 @@ int main () ...@@ -256,7 +257,7 @@ int main ()
std::cout << "Testing class_copyPropertyList ()...\n"; std::cout << "Testing class_copyPropertyList ()...\n";
{ {
unsigned int count; 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) if (count != 0 || list != NULL)
abort (); abort ();
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'ivar', covering all functions starting with 'ivar'. */ This is test 'ivar', covering all functions starting with 'ivar'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'method', covering all functions starting with 'method'. */ This is test 'method', covering all functions starting with 'method'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'objc', covering all functions starting with 'objc'. */ This is test 'objc', covering all functions starting with 'objc'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -103,7 +104,10 @@ int main () ...@@ -103,7 +104,10 @@ int main ()
std::cout << "Testing objc_disposeClassPair ()...\n"; std::cout << "Testing objc_disposeClassPair ()...\n";
{ {
Method method = class_getInstanceMethod (objc_getClass ("MySubClass"), @selector (setVariable:)); 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. */ /* Add a bit of everything to the class to exercise undoing all these changes. */
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'object', covering all functions starting with 'object'. */ This is test 'object', covering all functions starting with 'object'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'property', covering all functions starting with 'property'. */ This is test 'property', covering all functions starting with 'property'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -50,15 +51,22 @@ int main () ...@@ -50,15 +51,22 @@ int main ()
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
std::cout << "Testing property_getAttributes () ...\n"; std::cout << "Testing property_getAttributes () ...\n";
{ {
/* The Apple/NeXT runtime seems to crash on the following. */
#ifdef __GNU_LIBOBJC__
if (property_getAttributes (NULL) != NULL) if (property_getAttributes (NULL) != NULL)
abort (); abort ();
#endif
} }
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
std::cout << "Testing property_getName () ...\n"; std::cout << "Testing property_getName () ...\n";
{ {
/* The Apple/NeXT runtime seems to crash on the following. */
#ifdef __GNU_LIBOBJC__
if (property_getName (NULL) != NULL) if (property_getName (NULL) != NULL)
abort (); abort ();
#endif
} }
return (0); return (0);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'protocol', covering all functions starting with 'protocol'. */ This is test 'protocol', covering all functions starting with 'protocol'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -88,7 +89,7 @@ int main () ...@@ -88,7 +89,7 @@ int main ()
std::cout << "Testing protocol_copyPropertyList ()...\n"; std::cout << "Testing protocol_copyPropertyList ()...\n";
{ {
unsigned int count; unsigned int count;
Property *list; objc_property_t *list;
list = protocol_copyPropertyList (@protocol (MyProtocol), &count); list = protocol_copyPropertyList (@protocol (MyProtocol), &count);
...@@ -136,7 +137,7 @@ int main () ...@@ -136,7 +137,7 @@ int main ()
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
std::cout << "Testing protocol_getProperty ()...\n"; std::cout << "Testing protocol_getProperty ()...\n";
{ {
Property property; objc_property_t property;
property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty", property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty",
YES, YES); YES, YES);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'class', covering all functions starting with 'class'. */ This is test 'class', covering all functions starting with 'class'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -256,7 +257,7 @@ int main(int argc, void **args) ...@@ -256,7 +257,7 @@ int main(int argc, void **args)
printf ("Testing class_copyPropertyList ()...\n"); printf ("Testing class_copyPropertyList ()...\n");
{ {
unsigned int count; 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) if (count != 0 || list != NULL)
abort (); abort ();
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'ivar', covering all functions starting with 'ivar'. */ This is test 'ivar', covering all functions starting with 'ivar'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'method', covering all functions starting with 'method'. */ This is test 'method', covering all functions starting with 'method'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'objc', covering all functions starting with 'objc'. */ This is test 'objc', covering all functions starting with 'objc'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -103,7 +104,10 @@ int main(int argc, void **args) ...@@ -103,7 +104,10 @@ int main(int argc, void **args)
printf ("Testing objc_disposeClassPair ()...\n"); printf ("Testing objc_disposeClassPair ()...\n");
{ {
Method method = class_getInstanceMethod (objc_getClass ("MySubClass"), @selector (setVariable:)); 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. */ /* Add a bit of everything to the class to exercise undoing all these changes. */
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'object', covering all functions starting with 'object'. */ This is test 'object', covering all functions starting with 'object'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'property', covering all functions starting with 'property'. */ This is test 'property', covering all functions starting with 'property'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -50,15 +51,21 @@ int main(int argc, void **args) ...@@ -50,15 +51,21 @@ int main(int argc, void **args)
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
printf ("Testing property_getAttributes () ...\n"); printf ("Testing property_getAttributes () ...\n");
{ {
/* The Apple/NeXT runtime seems to crash on the following. */
#ifdef __GNU_LIBOBJC__
if (property_getAttributes (NULL) != NULL) if (property_getAttributes (NULL) != NULL)
abort (); abort ();
#endif
} }
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
printf ("Testing property_getName () ...\n"); printf ("Testing property_getName () ...\n");
{ {
/* The Apple/NeXT runtime seems to crash on the following. */
#ifdef __GNU_LIBOBJC__
if (property_getName (NULL) != NULL) if (property_getName (NULL) != NULL)
abort (); abort ();
#endif
} }
return 0; return 0;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
This is test 'protocol', covering all functions starting with 'protocol'. */ This is test 'protocol', covering all functions starting with 'protocol'. */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include /* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */ objc/runtime.h. */
...@@ -16,11 +15,13 @@ ...@@ -16,11 +15,13 @@
{ Class isa; } { Class isa; }
+ alloc; + alloc;
- - init; - - init;
+ + initialize;
@end @end
@implementation MyRootClass @implementation MyRootClass
+ + alloc { return class_createInstance (self, 0); } + + alloc { return class_createInstance (self, 0); }
- init { return self; } - init { return self; }
+ initialize { return self; }
@end @end
@protocol MyProtocol @protocol MyProtocol
...@@ -88,7 +89,7 @@ int main(int argc, void **args) ...@@ -88,7 +89,7 @@ int main(int argc, void **args)
printf ("Testing protocol_copyPropertyList ()...\n"); printf ("Testing protocol_copyPropertyList ()...\n");
{ {
unsigned int count; unsigned int count;
Property *list; objc_property_t *list;
list = protocol_copyPropertyList (@protocol (MyProtocol), &count); list = protocol_copyPropertyList (@protocol (MyProtocol), &count);
...@@ -136,7 +137,7 @@ int main(int argc, void **args) ...@@ -136,7 +137,7 @@ int main(int argc, void **args)
/* TODO: Test new ABI (when available). */ /* TODO: Test new ABI (when available). */
printf ("Testing protocol_getProperty ()...\n"); printf ("Testing protocol_getProperty ()...\n");
{ {
Property property; objc_property_t property;
property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty", property = protocol_getProperty (objc_getProtocol ("MyProtocol"), "someProperty",
YES, YES); YES, YES);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment