aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/fix-and-continue-1.m
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2005-04-26 00:50:31 +0000
committerMike Stump <mrs@gcc.gnu.org>2005-04-26 00:50:31 +0000
commitd6ff8575f861ee0c8e73b5d5c9fe90a8148c9f8d (patch)
tree69d310537455ae26ab8d4c59afb14ba65a644e41 /gcc/testsuite/objc.dg/fix-and-continue-1.m
parent2653bb0c120ca2454c2d9af1b94674ad0c5e9732 (diff)
downloadgcc-d6ff8575f861ee0c8e73b5d5c9fe90a8148c9f8d.zip
gcc-d6ff8575f861ee0c8e73b5d5c9fe90a8148c9f8d.tar.gz
gcc-d6ff8575f861ee0c8e73b5d5c9fe90a8148c9f8d.tar.bz2
darwin.c (darwin_encode_section_info): Always set MACHO_SYMBOL_STATIC for all ! TREE_PUBLIC symbols.
* config/darwin.c (darwin_encode_section_info): Always set MACHO_SYMBOL_STATIC for all ! TREE_PUBLIC symbols. * objc.dg/fix-and-continue-1.m: Add. From-SVN: r98755
Diffstat (limited to 'gcc/testsuite/objc.dg/fix-and-continue-1.m')
-rw-r--r--gcc/testsuite/objc.dg/fix-and-continue-1.m90
1 files changed, 90 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/fix-and-continue-1.m b/gcc/testsuite/objc.dg/fix-and-continue-1.m
new file mode 100644
index 0000000..49250c2
--- /dev/null
+++ b/gcc/testsuite/objc.dg/fix-and-continue-1.m
@@ -0,0 +1,90 @@
+/* Fix and continue should not interfere with computation of
+ local (static) function addresses. */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-do run { target *-*-darwin* } } */
+/* { dg-options "-mfix-and-continue" } */
+
+#include <objc/Object.h>
+#include <stdlib.h>
+
+@class MyTarget, MySet;
+
+int global_value = 0;
+
+@interface MyTargetBuildContext : Object
+{
+ MyTarget * _target;
+ unsigned _cacheInvalDisableCount;
+ BOOL _cacheInvalidationNeeded;
+ unsigned short _isCreatingDependencies:1;
+ unsigned short _isCreatingHeadermap:1;
+ unsigned short _haveAddedIdleTimeInvoc:1;
+ BOOL _hasSetUpBuildSettings;
+}
+- (id)initWithTarget:(MyTarget *)target;
+- (MyTarget *)target;
+@end
+
+@interface MyTargetBuildContext (PrivateMethods)
++ (MySet *)_headerFileExtensions;
+@end
+
+@interface MyCountedSet: Object {
+@public
+ int cardinality;
+}
+- (id)init;
+- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value;
+@end
+
+@implementation MyCountedSet
+- (id)init {
+ cardinality = 5;
+ global_value = 17;
+ return self;
+}
+- (id)sortedArrayUsingFunction:(int (*)(id, id, void *))comparator with:(int)value {
+ if(value == comparator(self, self, self))
+ return self;
+ return nil;
+}
+@end
+
+@implementation MyTargetBuildContext : Object
+- (id)initWithTarget:(MyTarget *)target
+{
+ self = [super init];
+ return self;
+}
+- (MyTarget *)target
+{
+ return _target;
+}
+
+static int _MyCompareObjectsByDecreasingSetCount (id object1, id object2, MyCountedSet * countedSet)
+{
+ global_value = 5;
+ return countedSet->cardinality;
+}
++ (MySet *)_headerFileExtensions
+{
+ MySet * _headerFileExtensions = 0;
+ return _headerFileExtensions;
+}
+- (void)_recomputeHeadermap
+{
+ MyCountedSet *set = [MyCountedSet new];
+ int (*functionPointer)(id, id, void *) = (int (*)(id, id, void *))_MyCompareObjectsByDecreasingSetCount;
+ id result = [set sortedArrayUsingFunction:functionPointer with:5];
+}
+@end
+
+int main(void) {
+ MyTargetBuildContext *ctx = [MyTargetBuildContext new];
+ [ctx _recomputeHeadermap];
+ if (global_value != 5)
+ abort();
+
+ return 0;
+}