Debian Codegraph @

gcc/testsuite/objc.dg/special/load-category-1.m

raw
1 /* Contributed by Nicola Pero <[email protected]>, December 2010. */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
5
6 #include <stdlib.h>
7 #include <objc/objc.h>
8
9 #include "load-category-1.h"
10
11 @implementation TestClass1
12 + initialize { return self; }
13 + load
14 {
15 increase_load_count ();
16 }
17 @end
18
19 @implementation TestClass2 (Category)
20 + load
21 {
22 increase_load_count ();
23 }
24 @end
25
26
27 static int load_count = 0;
28
29 int increase_load_count (void)
30 {
31 load_count++;
32 }
33
34 int main (void)
35 {
36 if (load_count != 4)
37 abort ();
38
39 return 0;
40 }