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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [torture/] [strings/] [const-str-8.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Test for assigning compile-time constant-string objects to static variables.  */
2
/* Contributed by Ziemowit Laski   */
3
 
4
/* { dg-do run { target *-*-darwin* } } */
5
/* { dg-options "-fconstant-string-class=Foo" } */
6
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
7
 
8
#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
9
#include 
10
 
11
@interface Foo: TestsuiteObject {
12
  char *cString;
13
  unsigned int len;
14
}
15
@end
16
 
17
#ifdef __NEXT_RUNTIME__
18
#ifdef NEXT_OBJC_USE_NEW_INTERFACE
19
Class _FooClassReference;
20
#else
21
struct objc_class _FooClassReference;
22
#endif
23
#endif
24
 
25
@implementation Foo : TestsuiteObject
26
- (char *)customString {
27
  return cString;
28
}
29
@end
30
 
31
static const Foo *appKey = @"MyApp";
32
static int CFPreferencesSynchronize (const Foo *ref) {
33
  return ref == appKey;
34
}
35
 
36
static void PrefsSynchronize(void)
37
{
38
  if(!CFPreferencesSynchronize(appKey))
39
    abort();
40
}
41
 
42
int main () {
43
  PrefsSynchronize();
44
  return 0;
45
}

powered by: WebSVN 2.1.0

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