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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [const-str-8.m] - Blame information for rev 862

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

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

powered by: WebSVN 2.1.0

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