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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [special/] [load-category-3.m] - Blame information for rev 797

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

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2
/* { dg-do run } */
3
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4
 
5
/* This test is identical to load-category-2, but the classes and
6
   categories are created in inverted order in the modules, to test
7
   that you can load classes first, or categories first, and it all
8
   still works in both cases.  */
9
 
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <objc/objc.h>
13
 
14
#include "load-category-3.h"
15
 
16
@implementation TestClass2 (Category)
17
+ load
18
{
19
  printf ("[TestClass2(Category) +load]\n");
20
 
21
  /* Check that the corresponding class's +load was done.  */
22
  check_that_load_step_was_completed (1);
23
 
24
  complete_load_step (4);
25
}
26
@end
27
 
28
@implementation TestClass3 (Category)
29
+ load
30
{
31
  printf ("[TestClass3(Category) +load]\n");
32
 
33
  /* Check that the corresponding class's +load was done.  */
34
  check_that_load_step_was_completed (2);
35
 
36
  complete_load_step (5);
37
}
38
@end
39
 
40
@implementation TestClass1 (Category)
41
+ load
42
{
43
  printf ("[TestClass1(Category) +load]\n");
44
 
45
  /* Check that the corresponding class's +load was done.  */
46
  check_that_load_step_was_completed (0);
47
 
48
  complete_load_step (3);
49
}
50
@end
51
 
52
static BOOL load_step_completed[6] = { NO, NO, NO, NO, NO, NO };
53
 
54
void complete_load_step (int load_step)
55
{
56
  load_step_completed[load_step] = YES;
57
}
58
 
59
void check_that_load_step_was_completed (int load_step)
60
{
61
  if (load_step_completed[load_step] == NO)
62
    {
63
      printf ("Load step %d was not completed but should have been\n", load_step);
64
      abort ();
65
    }
66
}
67
 
68
void check_that_load_step_was_not_completed (int load_step)
69
{
70
  if (load_step_completed[load_step] == YES)
71
    {
72
      printf ("Load step %d was completed but shouldn't have been\n", load_step);
73
      abort ();
74
    }
75
}
76
 
77
int main (void)
78
{
79
  check_that_load_step_was_completed (0);
80
  check_that_load_step_was_completed (1);
81
  check_that_load_step_was_completed (2);
82
  check_that_load_step_was_completed (3);
83
  check_that_load_step_was_completed (4);
84
  check_that_load_step_was_completed (5);
85
 
86
  return 0;
87
}

powered by: WebSVN 2.1.0

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