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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [fix-and-continue-1.m] - Blame information for rev 823

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

Line No. Rev Author Line
1 149 jeremybenn
/* Fix and continue should not interfere with computation of
2
   local (static) function addresses.  */
3
/* Author: Ziemowit Laski <zlaski@apple.com> */
4
 
5
/* { dg-do run  { target *-*-darwin* } } */
6
/* { dg-options "-mfix-and-continue" } */
7
 
8
#include <objc/Object.h>
9
#include <stdlib.h>
10
 
11
@class MyTarget, MySet;
12
 
13
int global_value = 0;
14
 
15
@interface MyTargetBuildContext : Object
16
{
17
  MyTarget * _target;
18
  unsigned _cacheInvalDisableCount;
19
  BOOL _cacheInvalidationNeeded;
20
  unsigned short _isCreatingDependencies:1;
21
  unsigned short _isCreatingHeadermap:1;
22
  unsigned short _haveAddedIdleTimeInvoc:1;
23
  BOOL _hasSetUpBuildSettings;
24
}
25
- (id)initWithTarget:(MyTarget *)target;
26
- (MyTarget *)target;
27
@end
28
 
29
@interface MyTargetBuildContext (PrivateMethods)
30
+ (MySet *)_headerFileExtensions;
31
@end
32
 
33
@interface MyCountedSet: Object {
34
@public
35
  int cardinality;
36
}
37
- (id)init;
38
- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value;
39
@end
40
 
41
@implementation MyCountedSet
42
- (id)init {
43
  cardinality = 5;
44
  global_value = 17;
45
  return self;
46
}
47
- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value {
48
  if(value == comparator(self, self, self))
49
    return self;
50
  return nil;
51
}
52
@end
53
 
54
@implementation MyTargetBuildContext : Object
55
- (id)initWithTarget:(MyTarget *)target
56
{
57
  self = [super init];
58
  return self;
59
}
60
- (MyTarget *)target
61
{
62
  return _target;
63
}
64
 
65
static int _MyCompareObjectsByDecreasingSetCount (id object1, id object2, MyCountedSet * countedSet)
66
{
67
  global_value = 5;
68
  return countedSet->cardinality;
69
}
70
+ (MySet *)_headerFileExtensions
71
{
72
  MySet * _headerFileExtensions = 0;
73
  return _headerFileExtensions;
74
}
75
- (void)_recomputeHeadermap
76
{
77
  MyCountedSet *set = [MyCountedSet new];
78
  int (*functionPointer)(id, id, void *) = (int (*)(id, id, void *))_MyCompareObjectsByDecreasingSetCount;
79
  id result = [set sortedArrayUsingFunction:functionPointer with:5];
80
}
81
@end
82
 
83
int main(void) {
84
  MyTargetBuildContext *ctx = [MyTargetBuildContext new];
85
  [ctx _recomputeHeadermap];
86
  if (global_value != 5)
87
    abort();
88
 
89
  return 0;
90
}

powered by: WebSVN 2.1.0

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