Debian Codegraph @

gcc/testsuite/objc.dg/torture/strings/const-str-7.m

raw
1 /* Test to make sure that the const objc strings are the same across scopes. */
2 /* Developed by Andrew Pinski <[email protected]> */
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 }