OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [obj-c++.dg/] [const-str-8.mm] - Blame information for rev 154

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   */
3
 
4
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
5
/* { dg-do run { target *-*-darwin* } } */
6
 
7
 
8
#include 
9
#include 
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.