diagnostics: add support for nested diagnostics [PR116253]
[official-gcc.git] / gcc / testsuite / objc.dg / torture / strings / const-str-11.m
blob2bdb1531e1d769d76c4f74f4193faaa452c4a4eb
1 /* Test if ObjC constant string layout is checked properly, regardless of how
2    constant string classes get derived.  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
5 /* { dg-do compile { target *-*-darwin* } } */
6 /* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */
7 /* { dg-options "-fconstant-string-class=XStr" } */
8 /* { dg-options "-mno-constant-cfstrings -fconstant-string-class=XStr" { target *-*-darwin* } } */
10 #include "../../../objc-obj-c++-shared/F-NSObject.h"
11 #include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE.  */
13 @interface XString: NSObject {
14 @protected
15     char *bytes;
17 @end
19 @interface XStr : XString {
20 @public
21     unsigned int len;
23 @end
25 #ifndef NEXT_OBJC_USE_NEW_INTERFACE
26 extern struct objc_class _XStrClassReference;
27 #else
28 extern Class _XStrClassReference;
29 #endif
31 const XStr *appKey = @"MyApp";
33 /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */
34 /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */
35 /* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data"  { target { *-*-darwin* && { ! lp64 } } } } } */
36 /* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */