diff options
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm')
-rw-r--r-- | gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm new file mode 100644 index 000000000..4a6142988 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-3.mm @@ -0,0 +1,27 @@ +/* Test for assigning compile-time constant-string objects to static variables. */ +/* Contributed by Ziemowit Laski <zlaski@apple.com> */ + +/* So far, CFString is darwin-only. */ +/* { dg-do run { target *-*-darwin* } } */ +/* { dg-skip-if "NeXT only" { *-*-* } { "-fgnu-runtime" } { "" } } */ +/* { dg-options "-mconstant-cfstrings -framework Foundation" } */ + +#include <stdlib.h> + +typedef const struct __CFString * CFStringRef; +static CFStringRef appKey = (CFStringRef) @"com.apple.soundpref"; + +static int CFPreferencesSynchronize (CFStringRef ref) { + return ref == appKey; +} + +static void PrefsSynchronize() +{ + if(!CFPreferencesSynchronize(appKey)) + abort(); +} + +int main(void) { + PrefsSynchronize(); + return 0; +} |