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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [objc.dg/] [const-str-7.m] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test to make sure that the const objc strings are the same across
2
   scopes.  */
3
/* Developed by Andrew Pinski <pinskia@physics.uc.edu> */
4
 
5
 
6
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
7
/* { dg-do run { target *-*-darwin* } } */
8
 
9
 
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <memory.h>
13
#include <objc/objc.h>
14
#include <objc/Object.h>
15
 
16
 
17
@interface Foo: Object {
18
  char *cString;
19
  unsigned int len;
20
}
21
- (char *)customString;
22
@end
23
 
24
struct objc_class _FooClassReference;
25
 
26
 
27
@implementation Foo : Object
28
- (char *)customString {
29
  return cString;
30
}
31
@end
32
 
33
 
34
int main () {
35
  Foo *string = @"bla";
36
  {
37
    Foo *string2 = @"bla";
38
 
39
 
40
    if(string != string2)
41
      abort();
42
    printf("Strings are being uniqued properly\n");
43
   }
44
  return 0;
45
}
46
 

powered by: WebSVN 2.1.0

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