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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [torture/] [strings/] [const-str-8.m] - Blame information for rev 704

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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