Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / objc.dg / const-str-8.m
blob60abcbd52b167165f28328215f1a51cf8b80326b
1 /* Test for assigning compile-time constant-string objects to static variables.  */
2 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
4 /* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
5 /* { dg-do run { target *-*-darwin* } } */
8 #include <stdlib.h>
9 #include <objc/Object.h>
11 @interface Foo: Object {
12   char *cString;
13   unsigned int len;
15 @end
17 struct objc_class _FooClassReference;
19 @implementation Foo : Object
20 - (char *)customString {
21   return cString;
23 @end
25 static const Foo *appKey = @"MyApp";
26 static int CFPreferencesSynchronize (const Foo *ref) {
27   return ref == appKey;
30 static void PrefsSynchronize(void)
32   if(!CFPreferencesSynchronize(appKey))
33     abort();
36 int main () {
37   PrefsSynchronize();
38   return 0;