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-7.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Test to make sure that the const objc strings are the same across scopes. */
2
/* Developed by Andrew Pinski <pinskia@physics.uc.edu> */
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 <stdio.h>
9
#include <stdlib.h>
10
#include <string.h>
11
 
12
@interface Foo: TestsuiteObject {
13
  char *cString;
14
  unsigned int len;
15
}
16
- (char *)customString;
17
@end
18
 
19
#ifdef __NEXT_RUNTIME__
20
#ifdef NEXT_OBJC_USE_NEW_INTERFACE
21
Class _FooClassReference;
22
#else
23
struct objc_class _FooClassReference;
24
#endif
25
#endif
26
 
27
@implementation Foo : TestsuiteObject
28
- (char *)customString {
29
  return cString;
30
}
31
@end
32
 
33
int main () {
34
  Foo *string = @"bla";
35
  {
36
    Foo *string2 = @"bla";
37
 
38
    if(string != string2)
39
      abort();
40
    printf("Strings are being uniqued properly\n");
41
   }
42
  return 0;
43
}

powered by: WebSVN 2.1.0

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