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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [const-str-7.m] - Blame information for rev 378

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

Line No. Rev Author Line
1 309 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-options "-fconstant-string-class=Foo " } */
4
/* { dg-do run } */
5
 
6
#include "../objc-obj-c++-shared/Object1.h"
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <memory.h>
10
 
11
@interface Foo: Object {
12
  char *cString;
13
  unsigned int len;
14
}
15
- (char *)customString;
16
@end
17
 
18
#ifndef NEXT_OBJC_USE_NEW_INTERFACE
19
struct objc_class _FooClassReference;
20
#else
21
Class _FooClassReference;
22
#endif
23
 
24
@implementation Foo : Object
25
- (char *)customString {
26
  return cString;
27
}
28
@end
29
 
30
int main () {
31
  Foo *string = @"bla";
32
  {
33
    Foo *string2 = @"bla";
34
 
35
    if(string != string2)
36
      abort();
37
    printf("Strings are being uniqued properly\n");
38
   }
39
  return 0;
40
}
41
 
42
#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.