OSDN Git Service

New tests
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / load-2.m
1 /* Contributed by Nicola Pero - Wed Jun  6 14:34:23 CEST 2001 */
2 #include <objc/objc.h>
3
4 /* Test that +load is automatically called before main is run;
5    on two different classes. */
6
7 static int static_variable1 = 0;
8 static int static_variable2 = 0;
9
10 @interface TestClass1
11 {
12   Class isa;
13 }
14 + (void) load;
15 @end
16
17 @implementation TestClass1
18 + (void) load
19 {
20   static_variable1 = 1;
21 }
22 @end
23
24 @interface TestClass2
25 {
26   Class isa;
27 }
28 + (void) load;
29 @end
30
31 @implementation TestClass2
32 + (void) load
33 {
34   static_variable2 = 1;
35 }
36 @end
37
38 int main (void)
39 {
40   if (static_variable1 != 1  ||  static_variable2 != 1)
41     {
42       abort ();
43     }
44
45   return 0;
46 }