PR tree-optimization/67955
[official-gcc.git] / gcc / testsuite / c-c++-common / raw-string-13.c
blob1b37405cee9cfd7e7a6e3530d9667f7e8acb85a4
1 // PR preprocessor/57620
2 // { dg-do run }
3 // { dg-require-effective-target wchar }
4 // { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
5 // { dg-options "-std=c++11" { target c++ } }
7 #ifndef __cplusplus
8 #include <wchar.h>
10 typedef __CHAR16_TYPE__ char16_t;
11 typedef __CHAR32_TYPE__ char32_t;
12 #endif
14 #define R
15 #define u
16 #define uR
17 #define U
18 #define UR
19 #define u8
20 #define u8R
21 #define L
22 #define LR
24 const char s00[] = R"??=??(??<??>??)??'??!??-\
25 (a)#[{}]^|~";
26 )??=??";
27 const char s01[] = R"a(
30 )a";
31 const char s02[] = R"a(
32 )a\
34 )a";
35 const char s03[] = R"ab(
36 )a\
38 )ab";
39 const char s04[] = R"a??/(x)a??/";
40 const char s05[] = R"abcdefghijklmn??(abc)abcdefghijklmn??";
41 const char s06[] = R"abcdefghijklm??/(abc)abcdefghijklm??/";
42 const char s07[] = R"abc(??)\
43 abc";)abc";
44 const char s08[] = R"def(de)\
45 def";)def";
46 const char s09[] = R"a(??)\
48 )a";
49 const char s10[] = R"a(??)a\
51 )a";
52 const char s11[] = R"ab(??)a\
54 )ab";
55 const char s12[] = R"a#(a#)a??=)a#";
56 const char s13[] = R"a#(??)a??=??)a#";
57 const char s14[] = R"??/(x)??/
58 ";)??/";
59 const char s15[] = R"??/(??)??/
60 ";)??/";
61 const char s16[] = R"??(??)??";
62 const char s17[] = R"?(?)??)?";
63 const char s18[] = R"??(??)??)??)??";
65 const char16_t u00[] = uR"??=??(??<??>??)??'??!??-\
66 (a)#[{}]^|~";
67 )??=??";
68 const char16_t u01[] = uR"a(
71 )a";
72 const char16_t u02[] = uR"a(
73 )a\
75 )a";
76 const char16_t u03[] = uR"ab(
77 )a\
79 )ab";
80 const char16_t u04[] = uR"a??/(x)a??/";
81 const char16_t u05[] = uR"abcdefghijklmn??(abc)abcdefghijklmn??";
82 const char16_t u06[] = uR"abcdefghijklm??/(abc)abcdefghijklm??/";
83 const char16_t u07[] = uR"abc(??)\
84 abc";)abc";
85 const char16_t u08[] = uR"def(de)\
86 def";)def";
87 const char16_t u09[] = uR"a(??)\
89 )a";
90 const char16_t u10[] = uR"a(??)a\
92 )a";
93 const char16_t u11[] = uR"ab(??)a\
95 )ab";
96 const char16_t u12[] = uR"a#(a#)a??=)a#";
97 const char16_t u13[] = uR"a#(??)a??=??)a#";
98 const char16_t u14[] = uR"??/(x)??/
99 ";)??/";
100 const char16_t u15[] = uR"??/(??)??/
101 ";)??/";
102 const char16_t u16[] = uR"??(??)??";
103 const char16_t u17[] = uR"?(?)??)?";
104 const char16_t u18[] = uR"??(??)??)??)??";
106 const char32_t U00[] = UR"??=??(??<??>??)??'??!??-\
107 (a)#[{}]^|~";
108 )??=??";
109 const char32_t U01[] = UR"a(
112 )a";
113 const char32_t U02[] = UR"a(
116 )a";
117 const char32_t U03[] = UR"ab(
120 )ab";
121 const char32_t U04[] = UR"a??/(x)a??/";
122 const char32_t U05[] = UR"abcdefghijklmn??(abc)abcdefghijklmn??";
123 const char32_t U06[] = UR"abcdefghijklm??/(abc)abcdefghijklm??/";
124 const char32_t U07[] = UR"abc(??)\
125 abc";)abc";
126 const char32_t U08[] = UR"def(de)\
127 def";)def";
128 const char32_t U09[] = UR"a(??)\
130 )a";
131 const char32_t U10[] = UR"a(??)a\
133 )a";
134 const char32_t U11[] = UR"ab(??)a\
136 )ab";
137 const char32_t U12[] = UR"a#(a#)a??=)a#";
138 const char32_t U13[] = UR"a#(??)a??=??)a#";
139 const char32_t U14[] = UR"??/(x)??/
140 ";)??/";
141 const char32_t U15[] = UR"??/(??)??/
142 ";)??/";
143 const char32_t U16[] = UR"??(??)??";
144 const char32_t U17[] = UR"?(?)??)?";
145 const char32_t U18[] = UR"??(??)??)??)??";
147 const wchar_t L00[] = LR"??=??(??<??>??)??'??!??-\
148 (a)#[{}]^|~";
149 )??=??";
150 const wchar_t L01[] = LR"a(
153 )a";
154 const wchar_t L02[] = LR"a(
157 )a";
158 const wchar_t L03[] = LR"ab(
161 )ab";
162 const wchar_t L04[] = LR"a??/(x)a??/";
163 const wchar_t L05[] = LR"abcdefghijklmn??(abc)abcdefghijklmn??";
164 const wchar_t L06[] = LR"abcdefghijklm??/(abc)abcdefghijklm??/";
165 const wchar_t L07[] = LR"abc(??)\
166 abc";)abc";
167 const wchar_t L08[] = LR"def(de)\
168 def";)def";
169 const wchar_t L09[] = LR"a(??)\
171 )a";
172 const wchar_t L10[] = LR"a(??)a\
174 )a";
175 const wchar_t L11[] = LR"ab(??)a\
177 )ab";
178 const wchar_t L12[] = LR"a#(a#)a??=)a#";
179 const wchar_t L13[] = LR"a#(??)a??=??)a#";
180 const wchar_t L14[] = LR"??/(x)??/
181 ";)??/";
182 const wchar_t L15[] = LR"??/(??)??/
183 ";)??/";
184 const wchar_t L16[] = LR"??(??)??";
185 const wchar_t L17[] = LR"?(?)??)?";
186 const wchar_t L18[] = LR"??(??)??)??)??";
189 main (void)
191 #define TEST(str, val) \
192 if (sizeof (str) != sizeof (val) \
193 || __builtin_memcmp (str, val, sizeof (str)) != 0) \
194 __builtin_abort ()
195 TEST (s00, "??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
196 TEST (s01, "\n)\\\na\"\n");
197 TEST (s02, "\n)a\\\n\"\n");
198 TEST (s03, "\n)a\\\nb\"\n");
199 TEST (s04, "x");
200 TEST (s05, "abc");
201 TEST (s06, "abc");
202 TEST (s07, "??"")\\\nabc\";");
203 TEST (s08, "de)\\\ndef\";");
204 TEST (s09, "??"")\\\na\"\n");
205 TEST (s10, "??"")a\\\n\"\n");
206 TEST (s11, "??"")a\\\nb\"\n");
207 TEST (s12, "a#)a??""=");
208 TEST (s13, "??"")a??""=??");
209 TEST (s14, "x)??""/\n\";");
210 TEST (s15, "??"")??""/\n\";");
211 TEST (s16, "??");
212 TEST (s17, "?)??");
213 TEST (s18, "??"")??"")??");
214 TEST (u00, u"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
215 TEST (u01, u"\n)\\\na\"\n");
216 TEST (u02, u"\n)a\\\n\"\n");
217 TEST (u03, u"\n)a\\\nb\"\n");
218 TEST (u04, u"x");
219 TEST (u05, u"abc");
220 TEST (u06, u"abc");
221 TEST (u07, u"??"")\\\nabc\";");
222 TEST (u08, u"de)\\\ndef\";");
223 TEST (u09, u"??"")\\\na\"\n");
224 TEST (u10, u"??"")a\\\n\"\n");
225 TEST (u11, u"??"")a\\\nb\"\n");
226 TEST (u12, u"a#)a??""=");
227 TEST (u13, u"??"")a??""=??");
228 TEST (u14, u"x)??""/\n\";");
229 TEST (u15, u"??"")??""/\n\";");
230 TEST (u16, u"??");
231 TEST (u17, u"?)??");
232 TEST (u18, u"??"")??"")??");
233 TEST (U00, U"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
234 TEST (U01, U"\n)\\\na\"\n");
235 TEST (U02, U"\n)a\\\n\"\n");
236 TEST (U03, U"\n)a\\\nb\"\n");
237 TEST (U04, U"x");
238 TEST (U05, U"abc");
239 TEST (U06, U"abc");
240 TEST (U07, U"??"")\\\nabc\";");
241 TEST (U08, U"de)\\\ndef\";");
242 TEST (U09, U"??"")\\\na\"\n");
243 TEST (U10, U"??"")a\\\n\"\n");
244 TEST (U11, U"??"")a\\\nb\"\n");
245 TEST (U12, U"a#)a??""=");
246 TEST (U13, U"??"")a??""=??");
247 TEST (U14, U"x)??""/\n\";");
248 TEST (U15, U"??"")??""/\n\";");
249 TEST (U16, U"??");
250 TEST (U17, U"?)??");
251 TEST (U18, U"??"")??"")??");
252 TEST (L00, L"??""<??"">??"")??""'??""!??""-\\\n(a)#[{}]^|~\";\n");
253 TEST (L01, L"\n)\\\na\"\n");
254 TEST (L02, L"\n)a\\\n\"\n");
255 TEST (L03, L"\n)a\\\nb\"\n");
256 TEST (L04, L"x");
257 TEST (L05, L"abc");
258 TEST (L06, L"abc");
259 TEST (L07, L"??"")\\\nabc\";");
260 TEST (L08, L"de)\\\ndef\";");
261 TEST (L09, L"??"")\\\na\"\n");
262 TEST (L10, L"??"")a\\\n\"\n");
263 TEST (L11, L"??"")a\\\nb\"\n");
264 TEST (L12, L"a#)a??""=");
265 TEST (L13, L"??"")a??""=??");
266 TEST (L14, L"x)??""/\n\";");
267 TEST (L15, L"??"")??""/\n\";");
268 TEST (L16, L"??");
269 TEST (L17, L"?)??");
270 TEST (L18, L"??"")??"")??");
271 return 0;