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-7.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 703 jeremybenn
/* Test to make sure that the const objc strings are the same across
2
   scopes.  */
3
/* Developed by Andrew Pinski  */
4
 
5
/* { dg-do run } */
6
/* { dg-options "-fconstant-string-class=Foo" } */
7
/* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
8
 
9
#include "../../../objc-obj-c++-shared/TestsuiteObject.m"
10
#include 
11
#include 
12
#include 
13
#include 
14
 
15
@interface Foo: TestsuiteObject {
16
  char *cString;
17
  unsigned int len;
18
}
19
- (char *)customString;
20
@end
21
 
22
#ifdef __NEXT_RUNTIME__
23
#ifdef NEXT_OBJC_USE_NEW_INTERFACE
24
Class  _FooClassReference;
25
#else
26
struct objc_class _FooClassReference;
27
#endif
28
#endif
29
 
30
@implementation Foo : TestsuiteObject
31
- (char *)customString {
32
  return cString;
33
}
34
@end
35
 
36
 
37
int main () {
38
  Foo *string = @"bla";
39
  {
40
    Foo *string2 = @"bla";
41
 
42
    if(string != string2)
43
      abort();
44
    printf("Strings are being uniqued properly\n");
45
   }
46
  return 0;
47
}

powered by: WebSVN 2.1.0

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