2014-04-07 Charles Baylis <charles.baylis@linaro.org>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / darwin-cfstring-3.C
blob2d755ec8dd0e4e66379236f034af3dcb00509ac5
1 /* Test whether the __builtin__CFStringMakeConstantString 
2    "function" generates compile-time objects with the correct layout. */
3 /* Developed by Ziemowit Laski <zlaski@apple.com>.  */
5 /* { dg-do compile { target *-*-darwin* } } */
6 /* { dg-options "-mconstant-cfstrings" } */
8 typedef const struct __CFString *CFStringRef;
10 #ifdef __CONSTANT_CFSTRINGS__
11 #define CFSTR(STR)  ((CFStringRef) __builtin___CFStringMakeConstantString (STR))
12 #else
13 #error __CONSTANT_CFSTRINGS__ not defined
14 #endif
16 extern int cond;
17 extern const char *func(void);
19 CFStringRef s0 = CFSTR("Hello" "there");
21 void foo(void) {
22   const CFStringRef s1 = CFSTR("Str1");
24   s0 = s1;
27 /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */
28 /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+LC.*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */
29 /* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t4\n" { target { *-*-darwin* && {  lp64 } } } } } */
30 /* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t10\n" { target { *-*-darwin* && {  lp64 } } } } } */