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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [fix-and-continue-1.m] - Blame information for rev 774

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

Line No. Rev Author Line
1 704 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
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
8
 
9
#include "../objc-obj-c++-shared/TestsuiteObject.m"
10
#include <stdlib.h>
11
 
12
@class MyTarget, MySet;
13
 
14
int global_value = 0;
15
 
16
@interface MyTargetBuildContext : TestsuiteObject
17
{
18
  MyTarget * _target;
19
  unsigned _cacheInvalDisableCount;
20
  BOOL _cacheInvalidationNeeded;
21
  unsigned short _isCreatingDependencies:1;
22
  unsigned short _isCreatingHeadermap:1;
23
  unsigned short _haveAddedIdleTimeInvoc:1;
24
  BOOL _hasSetUpBuildSettings;
25
}
26
- (id)initWithTarget:(MyTarget *)target;
27
- (MyTarget *)target;
28
@end
29
 
30
@interface MyTargetBuildContext (PrivateMethods)
31
+ (MySet *)_headerFileExtensions;
32
@end
33
 
34
@interface MyCountedSet: TestsuiteObject {
35
@public
36
  int cardinality;
37
}
38
- (id)init;
39
- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value;
40
@end
41
 
42
@implementation MyCountedSet
43
- (id)init {
44
  cardinality = 5;
45
  global_value = 17;
46
  return self;
47
}
48
- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value {
49
  if(value == comparator(self, self, self))
50
    return self;
51
  return nil;
52
}
53
@end
54
 
55
@implementation MyTargetBuildContext : TestsuiteObject
56
- (id)initWithTarget:(MyTarget *)target
57
{
58
  self = [super init];
59
  return self;
60
}
61
- (MyTarget *)target
62
{
63
  return _target;
64
}
65
 
66
static int _MyCompareObjectsByDecreasingSetCount (id object1, id object2, MyCountedSet * countedSet)
67
{
68
  global_value = 5;
69
  return countedSet->cardinality;
70
}
71
+ (MySet *)_headerFileExtensions
72
{
73
  MySet * _headerFileExtensions = 0;
74
  return _headerFileExtensions;
75
}
76
- (void)_recomputeHeadermap
77
{
78
  MyCountedSet *set = [MyCountedSet new];
79
  int (*functionPointer)(id, id, void *) = (int (*)(id, id, void *))_MyCompareObjectsByDecreasingSetCount;
80
  id result = [set sortedArrayUsingFunction:functionPointer with:5];
81
}
82
@end
83
 
84
int main(void) {
85
  MyTargetBuildContext *ctx = [MyTargetBuildContext new];
86
  [ctx _recomputeHeadermap];
87
  if (global_value != 5)
88
    abort();
89
 
90
  return 0;
91
}
92
 

powered by: WebSVN 2.1.0

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