aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc.dg/special/load-category-1.m
blob: cb221436f02eda03d2d34b3ac388f9ecbfe9b407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}