OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [const-str-8.m] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test for assigning compile-time constant-string objects to static variables.  */
2
/* Contributed by Ziemowit Laski <zlaski@apple.com>  */
3
 
4
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
5
/* { dg-do run { target *-*-darwin* } } */
6
 
7
 
8
#include <stdlib.h>
9
#include <objc/Object.h>
10
 
11
@interface Foo: Object {
12
  char *cString;
13
  unsigned int len;
14
}
15
@end
16
 
17
struct objc_class _FooClassReference;
18
 
19
@implementation Foo : Object
20
- (char *)customString {
21
  return cString;
22
}
23
@end
24
 
25
static const Foo *appKey = @"MyApp";
26
static int CFPreferencesSynchronize (const Foo *ref) {
27
  return ref == appKey;
28
}
29
 
30
static void PrefsSynchronize(void)
31
{
32
  if(!CFPreferencesSynchronize(appKey))
33
    abort();
34
}
35
 
36
int main () {
37
  PrefsSynchronize();
38
  return 0;
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.