From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/objc/execute/load-3.m | 109 ++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 gcc/testsuite/objc/execute/load-3.m (limited to 'gcc/testsuite/objc/execute/load-3.m') diff --git a/gcc/testsuite/objc/execute/load-3.m b/gcc/testsuite/objc/execute/load-3.m new file mode 100644 index 000000000..15dfc0b48 --- /dev/null +++ b/gcc/testsuite/objc/execute/load-3.m @@ -0,0 +1,109 @@ +/* + load-3.m + + Author: Ovidiu Predescu + Date: June 3, 2001 + + Test if the +load methods are invoked, and are invoked in the + proper order. + */ + +#include +#import "../../objc-obj-c++-shared/Object1.h" +#include + +@interface A : Object +@end + +@interface B : A +@end + +static a_load = 0; +static b_load = 0; +static a_category_load = 0; +static b_category_load = 0; + +@implementation A (Category) ++ (void)load +{ + a_category_load = 1; + printf("+[A(Category) load]\n"); + + if (a_load != 1) + { + printf("+load for A(Category) invoked before A's!\n"); + abort(); + } +} +@end + +@implementation B(Category) ++ (void)load +{ + b_category_load = 1; + printf("+[B(Category) load]\n"); + + if (b_load != 1) + { + printf ("+load for B(Category) invoked before B!\n"); + abort(); + } +} +@end + +@implementation B ++ (void)load +{ + b_load = 1; + printf("+[B load]\n"); + + if (a_load != 1) + { + printf("+load for B invoked before A's!\n"); + abort(); + } + + if (b_category_load != 0) + { + printf("+load for B invoked after B(Category)!\n"); + abort(); + } +} +@end + +@implementation A ++ (void)load +{ + a_load = 1; + printf("+[A load]\n"); + + if (a_category_load != 0) + { + printf("+load for A(Category) invoked before A!\n"); + abort(); + } + + if (b_load != 0) + { + printf("+load for A invoked after B!\n"); + abort(); + } + + if (b_category_load != 0) + { + printf("+load for B(Category) invoked before A and B!\n"); + abort(); + } +} +@end + +int main (void) +{ + if (a_load + b_load + a_category_load + b_category_load != 4) + { + printf("Not all +load methods invoked!\n"); + abort(); + } + + return 0; +} -- cgit v1.2.3