Debian Codegraph @

gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm

raw
1 /* Test for assigning compile-time constant-string objects to static variables. */
2 /* Contributed by Ziemowit Laski <[email protected]> */
3
4 /* So far, CFString is darwin-only. */
5 /* { dg-do run { target *-*-darwin* } } */
6 /* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */
7 /* { dg-options "-mconstant-cfstrings -framework Foundation" } */
8
9 #include <stdlib.h>
10
11 typedef const struct __CFString * CFStringRef;
12 static CFStringRef appKey = (CFStringRef) @"com.apple.soundpref";
13
14 static int CFPreferencesSynchronize (CFStringRef ref) {
15 return ref == appKey;
16 }
17
18 static void PrefsSynchronize()
19 {
20 if(!CFPreferencesSynchronize(appKey))
21 abort();
22 }
23
24 int main(void) {
25 PrefsSynchronize();
26 return 0;
27 }