Debian Codegraph @

gcc/testsuite/objc/execute/initialize.m

raw
1 /* Contributed by Nicola Pero - Wed Mar 7 17:55:04 CET 2001 */
2 #include <objc/objc.h>
3
4 /* Test that +initialize is automatically called before the class is
5 accessed */
6
7 static int class_variable = 0;
8
9 @interface TestClass
10 {
11 Class isa;
12 }
13 + (void) initialize;
14 + (int) classVariable;
15 @end
16
17 @implementation TestClass
18 + (void) initialize
19 {
20 class_variable = 1;
21 }
22 + (int) classVariable
23 {
24 return class_variable;
25 }
26 @end
27
28 int main (void)
29 {
30 if ([TestClass classVariable] != 1)
31 {
32 abort ();
33 }
34
35 return 0;
36 }