aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/const-cfstring-3.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/const-cfstring-3.m')
-rw-r--r--gcc/testsuite/objc.dg/const-cfstring-3.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/const-cfstring-3.m b/gcc/testsuite/objc.dg/const-cfstring-3.m
new file mode 100644
index 00000000000..82f361cec6f
--- /dev/null
+++ b/gcc/testsuite/objc.dg/const-cfstring-3.m
@@ -0,0 +1,26 @@
+/* APPLE LOCAL file constant strings */
+/* Test for assigning compile-time constant-string objects to static variables. */
+/* Contributed by Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-options "-fconstant-cfstrings -framework Foundation" } */
+/* { dg-do run { target *-*-darwin* } } */
+
+#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;
+}