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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc/] [execute/] [initialize.m] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
/* Contributed by Nicola Pero - Wed Mar  7 17:55:04 CET 2001 */
/* Contributed by Nicola Pero - Wed Mar  7 17:55:04 CET 2001 */
#include <objc/objc.h>
#include <objc/objc.h>
 
 
/* Test that +initialize is automatically called before the class is
/* Test that +initialize is automatically called before the class is
   accessed */
   accessed */
 
 
static int class_variable = 0;
static int class_variable = 0;
 
 
@interface TestClass
@interface TestClass
{
{
  Class isa;
  Class isa;
}
}
+ (void) initialize;
+ (void) initialize;
+ (int) classVariable;
+ (int) classVariable;
@end
@end
 
 
@implementation TestClass
@implementation TestClass
+ (void) initialize
+ (void) initialize
{
{
  class_variable = 1;
  class_variable = 1;
}
}
+ (int) classVariable
+ (int) classVariable
{
{
  return class_variable;
  return class_variable;
}
}
@end
@end
 
 
int main (void)
int main (void)
{
{
  if ([TestClass classVariable] != 1)
  if ([TestClass classVariable] != 1)
    {
    {
      abort ();
      abort ();
    }
    }
 
 
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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