OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc/] [execute/] [initialize-1.m] - Blame information for rev 702

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 702 jeremybenn
/* Contributed by Nicola Pero - Sat  8 Oct 2011 16:47:48 BST */
2
#include <objc/objc.h>
3
 
4
/* Test that if a class has no +initialize method, the superclass
5
   implementation is called.  */
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++;
21
}
22
+ (int) classVariable
23
{
24
  return class_variable;
25
}
26
@end
27
 
28
@interface TestSubClass : TestClass
29
@end
30
 
31
@implementation TestSubClass
32
@end
33
 
34
int main (void)
35
{
36
  if ([TestClass classVariable] != 1)
37
    {
38
      abort ();
39
    }
40
 
41
  if ([TestSubClass classVariable] != 2)
42
    {
43
      abort ();
44
    }
45
 
46
  return 0;
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.