OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc/] [execute/] [initialize.m] - Blame information for rev 378

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 307 jeremybenn
/* 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
}

powered by: WebSVN 2.1.0

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