diff options
author | no-author <no-author@gcc.gnu.org> | 2004-11-18 03:16:25 +0000 |
---|---|---|
committer | no-author <no-author@gcc.gnu.org> | 2004-11-18 03:16:25 +0000 |
commit | 91e68210539802160600bfb2fdbae974786c112a (patch) | |
tree | b9a71118b4a71c61156e8141242e843a36e14908 /gcc/testsuite/objc.dg | |
parent | 9c7d425f179f81843832146b84eee5fac1eb3d61 (diff) |
This commit was manufactured by cvs2svn to create branch
'tree-cleanup-branch'.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-cleanup-branch@90847 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r-- | gcc/testsuite/objc.dg/const-str-8.m | 39 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/const-str-9.m | 20 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/desig-init-2.m | 7 |
3 files changed, 66 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/const-str-8.m b/gcc/testsuite/objc.dg/const-str-8.m new file mode 100644 index 00000000000..60abcbd52b1 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-8.m @@ -0,0 +1,39 @@ +/* Test for assigning compile-time constant-string objects to static variables. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */ +/* { dg-do run { target *-*-darwin* } } */ + + +#include <stdlib.h> +#include <objc/Object.h> + +@interface Foo: Object { + char *cString; + unsigned int len; +} +@end + +struct objc_class _FooClassReference; + +@implementation Foo : Object +- (char *)customString { + return cString; +} +@end + +static const Foo *appKey = @"MyApp"; +static int CFPreferencesSynchronize (const Foo *ref) { + return ref == appKey; +} + +static void PrefsSynchronize(void) +{ + if(!CFPreferencesSynchronize(appKey)) + abort(); +} + +int main () { + PrefsSynchronize(); + return 0; +} diff --git a/gcc/testsuite/objc.dg/const-str-9.m b/gcc/testsuite/objc.dg/const-str-9.m new file mode 100644 index 00000000000..033337452d4 --- /dev/null +++ b/gcc/testsuite/objc.dg/const-str-9.m @@ -0,0 +1,20 @@ +/* Test if ObjC constant strings get placed in the correct section. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* { dg-options "-fnext-runtime" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +#include <objc/Object.h> + +@interface NSConstantString: Object { + char *cString; + unsigned int len; +} +@end + +extern struct objc_class _NSConstantStringClassReference; + +static const NSConstantString *appKey = @"MyApp"; + +/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */ diff --git a/gcc/testsuite/objc.dg/desig-init-2.m b/gcc/testsuite/objc.dg/desig-init-2.m new file mode 100644 index 00000000000..cf8e0c1c3a9 --- /dev/null +++ b/gcc/testsuite/objc.dg/desig-init-2.m @@ -0,0 +1,7 @@ +/* Test handling of C99 designator lists in Objective-C. Test array + designators after structure member designators. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +struct s { int a[2]; } x = { .a[0] = 1 }; |