diff options
Diffstat (limited to 'gcc/testsuite/objc.dg/special/load-category-1.m')
-rw-r--r-- | gcc/testsuite/objc.dg/special/load-category-1.m | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/special/load-category-1.m b/gcc/testsuite/objc.dg/special/load-category-1.m new file mode 100644 index 000000000..cb221436f --- /dev/null +++ b/gcc/testsuite/objc.dg/special/load-category-1.m @@ -0,0 +1,39 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */ +/* { dg-do run } */ +/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ + +#include <stdlib.h> +#include <objc/objc.h> + +#include "load-category-1.h" + +@implementation TestClass1 ++ initialize { return self; } ++ load +{ + increase_load_count (); +} +@end + +@implementation TestClass2 (Category) ++ load +{ + increase_load_count (); +} +@end + + +static int load_count = 0; + +int increase_load_count (void) +{ + load_count++; +} + +int main (void) +{ + if (load_count != 4) + abort (); + + return 0; +} |