Debian Codegraph @

gcc/testsuite/objc.dg/gnu-runtime-2.m

raw
1 /* Sanity check for GNU-runtime version of constant strings,
2 regardless of runtime used on target system. */
3
4 /* { dg-do compile } */
5 /* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
6
7 #include <objc/Object.h>
8 #include <string.h>
9 #include <stdlib.h>
10
11 @interface NXConstantString: Object
12 {
13 char *c_string;
14 unsigned int len;
15 }
16 -(const char *) cString;
17 -(unsigned int) length;
18 @end
19
20 @implementation NXConstantString
21 -(const char *) cString { return c_string; }
22 -(unsigned int) length { return len; }
23 @end
24
25 int main(int argc, void **args)
26 {
27 if (strcmp ([@"this is a string" cString], "this is a string"))
28 abort ();
29 return 0;
30 }