aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/const-cfstring-3.m
blob: 82f361cec6f34bc7a6ae5afeef42287015941ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}