PR target/83368
[official-gcc.git] / gcc / testsuite / c-c++-common / raw-string-2.c
blob6f2e37d47cabbffc86d116a82465c989510daab6
1 // { dg-do run }
2 // { dg-require-effective-target wchar }
3 // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
4 // { dg-options "-std=c++0x" { target c++ } }
6 #ifndef __cplusplus
7 #include <wchar.h>
9 typedef __CHAR16_TYPE__ char16_t;
10 typedef __CHAR32_TYPE__ char32_t;
11 #endif
13 #define R
14 #define u
15 #define uR
16 #define U
17 #define UR
18 #define u8
19 #define u8R
20 #define L
21 #define LR
23 const char s00[] = R"(a)" "(b)";
24 const char s01[] = "(a)" R"*(b)*";
25 const char s02[] = R"(a)" R"(b)";
26 const char s03[] = R"-(a)-" u8"(b)";
27 const char s04[] = "(a)" u8R"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
28 const char s05[] = R"(a)" u8R"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
29 const char s06[] = u8R";[(a);[" "(b)";
30 const char s07[] = u8"(a)" R"(b)";
31 const char s08[] = u8R"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
32 const char s09[] = u8R"/^&|~!=,"'(a)/^&|~!=,"'" u8"(b)";
33 const char s10[] = u8"(a)" u8R"0123456789abcdef(b)0123456789abcdef";
34 const char s11[] = u8R"ghijklmnopqrstuv(a)ghijklmnopqrstuv" u8R"w(b)w";
36 const char16_t u03[] = R"-(a)-" u"(b)";
37 const char16_t u04[] = "(a)" uR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
38 const char16_t u05[] = R"(a)" uR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
39 const char16_t u06[] = uR";[(a);[" "(b)";
40 const char16_t u07[] = u"(a)" R"(b)";
41 const char16_t u08[] = uR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
42 const char16_t u09[] = uR"/^&|~!=,"'(a)/^&|~!=,"'" u"(b)";
43 const char16_t u10[] = u"(a)" uR"0123456789abcdef(b)0123456789abcdef";
44 const char16_t u11[] = uR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" uR"w(b)w";
46 const char32_t U03[] = R"-(a)-" U"(b)";
47 const char32_t U04[] = "(a)" UR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
48 const char32_t U05[] = R"(a)" UR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
49 const char32_t U06[] = UR";[(a);[" "(b)";
50 const char32_t U07[] = U"(a)" R"(b)";
51 const char32_t U08[] = UR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
52 const char32_t U09[] = UR"/^&|~!=,"'(a)/^&|~!=,"'" U"(b)";
53 const char32_t U10[] = U"(a)" UR"0123456789abcdef(b)0123456789abcdef";
54 const char32_t U11[] = UR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" UR"w(b)w";
56 const wchar_t L03[] = R"-(a)-" L"(b)";
57 const wchar_t L04[] = "(a)" LR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
58 const wchar_t L05[] = R"(a)" LR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
59 const wchar_t L06[] = LR";[(a);[" "(b)";
60 const wchar_t L07[] = L"(a)" R"(b)";
61 const wchar_t L08[] = LR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
62 const wchar_t L09[] = LR"/^&|~!=,"'(a)/^&|~!=,"'" L"(b)";
63 const wchar_t L10[] = L"(a)" LR"0123456789abcdef(b)0123456789abcdef";
64 const wchar_t L11[] = LR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" LR"w(b)w";
66 int
67 main (void)
69 #define TEST(str, val) \
70 if (sizeof (str) != sizeof (val) \
71 || __builtin_memcmp (str, val, sizeof (str)) != 0) \
72 __builtin_abort ()
73 TEST (s00, "a(b)");
74 TEST (s01, "(a)b");
75 TEST (s02, "ab");
76 TEST (s03, "a(b)");
77 TEST (s04, "(a)b");
78 TEST (s05, "ab");
79 TEST (s06, "a(b)");
80 TEST (s07, "(a)b");
81 TEST (s08, "ab");
82 TEST (s09, "a(b)");
83 TEST (s10, "(a)b");
84 TEST (s11, "ab");
85 TEST (u03, u"a(b)");
86 TEST (u04, u"(a)b");
87 TEST (u05, u"ab");
88 TEST (u06, u"a(b)");
89 TEST (u07, u"(a)b");
90 TEST (u08, u"ab");
91 TEST (u09, u"a(b)");
92 TEST (u10, u"(a)b");
93 TEST (u11, u"ab");
94 TEST (U03, U"a(b)");
95 TEST (U04, U"(a)b");
96 TEST (U05, U"ab");
97 TEST (U06, U"a(b)");
98 TEST (U07, U"(a)b");
99 TEST (U08, U"ab");
100 TEST (U09, U"a(b)");
101 TEST (U10, U"(a)b");
102 TEST (U11, U"ab");
103 TEST (L03, L"a(b)");
104 TEST (L04, L"(a)b");
105 TEST (L05, L"ab");
106 TEST (L06, L"a(b)");
107 TEST (L07, L"(a)b");
108 TEST (L08, L"ab");
109 TEST (L09, L"a(b)");
110 TEST (L10, L"(a)b");
111 TEST (L11, L"ab");
112 return 0;