Debian Codegraph @

gcc/testsuite/obj-c++.dg/torture/strings/const-str-7.mm

raw
1 /* Test to make sure that the const objc strings are the same across
2 scopes. */
3 /* Developed by Andrew Pinski <[email protected]> */
4
5 /* { dg-do run } */
6 /* { dg-options "-fconstant-string-class=Foo" } */
7 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=Foo" { target *-*-darwin* } } */
8
9 #include "../../../objc-obj-c++-shared/TestsuiteObject.m"
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <objc/objc.h>
14
15 @interface Foo: TestsuiteObject {
16 char *cString;
17 unsigned int len;
18 }
19 - (char *)customString;
20 @end
21
22 #ifdef __NEXT_RUNTIME__
23 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
24 Class _FooClassReference;
25 #else
26 struct objc_class _FooClassReference;
27 #endif
28 #endif
29
30 @implementation Foo : TestsuiteObject
31 - (char *)customString {
32 return cString;
33 }
34 @end
35
36
37 int main () {
38 Foo *string = @"bla";
39 {
40 Foo *string2 = @"bla";
41
42 if(string != string2)
43 abort();
44 printf("Strings are being uniqued properly\n");
45 }
46 return 0;
47 }