xref: /netbsd-src/tests/usr.bin/xlint/lint1/lex_wide_string.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: lex_wide_string.c,v 1.3 2022/06/17 18:54:53 rillig Exp $	*/
2 # 3 "lex_wide_string.c"
3 
4 /*
5  * Test lexical analysis of wide string constants.
6  *
7  * C99 6.4.5 "String literals"
8  */
9 
10 void sink(const int *);
11 
12 void
13 test(void)
14 {
15 	sink(L"");
16 
17 	sink(L"hello, world\n");
18 
19 	sink(L"\0");
20 
21 	sink(L"\0\0\0\0");
22 
23 	/* expect+1: error: no hex digits follow \x [74] */
24 	sink(L"\x");
25 
26 	/* expect+1: warning: dubious escape \y [79] */
27 	sink(L"\y");
28 
29 	sink(L"first" L"second");
30 
31 	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
32 	sink(L"wide" "plain");
33 }
34