aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/const-cfstring-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.apple/const-cfstring-4.c')
-rw-r--r--gcc/testsuite/gcc.apple/const-cfstring-4.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.apple/const-cfstring-4.c b/gcc/testsuite/gcc.apple/const-cfstring-4.c
new file mode 100644
index 00000000000..0c7c326100e
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/const-cfstring-4.c
@@ -0,0 +1,30 @@
+/* APPLE LOCAL file */
+/* Test constant cfstring and writabe strings interaction.
+ Radar 3978580. */
+/* Developed by Devang Patel <dpatel@apple.com>. */
+
+/* { dg-do assemble { target *-*-darwin* } } */
+/* { dg-options "-fconstant-cfstrings -fwritable-strings" } */
+
+typedef const struct __CFString *CFStringRef;
+
+#ifdef __CONSTANT_CFSTRINGS__
+#define CFSTR(STR) ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
+#else
+#error __CONSTANT_CFSTRINGS__ not defined
+#endif
+
+extern void bar (const void **);
+
+static void foo()
+{
+ CFStringRef keys[] =
+ {
+ CFSTR("blah1"),
+ CFSTR("blah2")
+ };
+ int count = sizeof(keys) / sizeof(keys[0]);
+
+ bar ((const void **)keys);
+}
+