Debian Codegraph @

gcc/testsuite/objc.dg/torture/strings/const-str-8.m

raw
1 /* Test for assigning compile-time constant-string objects to static variables. */
2 /* Contributed by Ziemowit Laski <[email protected]> */
3 /* { dg-do run } */
4 /* { dg-options "-fconstant-string-class=Foo" } */
5 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
6
7 #include "../../../objc-obj-c++-shared/TestsuiteObject.m"
8 #include <stdlib.h>
9
10 @interface Foo: TestsuiteObject {
11 char *cString;
12 unsigned int len;
13 }
14 @end
15
16 #ifdef __NEXT_RUNTIME__
17 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
18 Class _FooClassReference;
19 #else
20 struct objc_class _FooClassReference;
21 #endif
22 #endif
23
24 @implementation Foo : TestsuiteObject
25 - (char *)customString {
26 return cString;
27 }
28 @end
29
30 static const Foo *appKey = @"MyApp";
31 static int CFPreferencesSynchronize (const Foo *ref) {
32 return ref == appKey;
33 }
34
35 static void PrefsSynchronize(void)
36 {
37 if(!CFPreferencesSynchronize(appKey))
38 abort();
39 }
40
41 int main () {
42 PrefsSynchronize();
43 return 0;
44 }