URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* Test the -fconstant-string-class=Foo option under the NeXT
|
/* Test the -fconstant-string-class=Foo option under the NeXT
|
runtime. */
|
runtime. */
|
/* Developed by Markus Hitter . */
|
/* Developed by Markus Hitter . */
|
|
|
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
|
/* { dg-options "-fnext-runtime -fconstant-string-class=Foo -lobjc" } */
|
/* { dg-do run { target *-*-darwin* } } */
|
/* { dg-do run { target *-*-darwin* } } */
|
|
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
|
|
@interface Foo: Object {
|
@interface Foo: Object {
|
char *cString;
|
char *cString;
|
unsigned int len;
|
unsigned int len;
|
}
|
}
|
- (char *)customString;
|
- (char *)customString;
|
@end
|
@end
|
|
|
struct objc_class _FooClassReference;
|
struct objc_class _FooClassReference;
|
|
|
@implementation Foo : Object
|
@implementation Foo : Object
|
- (char *)customString {
|
- (char *)customString {
|
return cString;
|
return cString;
|
}
|
}
|
@end
|
@end
|
|
|
int main () {
|
int main () {
|
Foo *string = @"bla";
|
Foo *string = @"bla";
|
Foo *string2 = @"bla";
|
Foo *string2 = @"bla";
|
|
|
if(string != string2)
|
if(string != string2)
|
abort();
|
abort();
|
printf("Strings are being uniqued properly\n");
|
printf("Strings are being uniqued properly\n");
|
|
|
/* This memcpy has to be done before the first message is sent to a
|
/* This memcpy has to be done before the first message is sent to a
|
constant string object. Can't be moved to +initialize since _that_
|
constant string object. Can't be moved to +initialize since _that_
|
is already a message. */
|
is already a message. */
|
|
|
memcpy(&_FooClassReference, objc_getClass("Foo"), sizeof(_FooClassReference));
|
memcpy(&_FooClassReference, objc_getClass("Foo"), sizeof(_FooClassReference));
|
if (strcmp ([string customString], "bla")) {
|
if (strcmp ([string customString], "bla")) {
|
abort ();
|
abort ();
|
}
|
}
|
|
|
printf([@"This is a working constant string object\n" customString]);
|
printf([@"This is a working constant string object\n" customString]);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.