xref: /netbsd-src/tests/usr.bin/xlint/lint1/lex_wide_string.c (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1 /*	$NetBSD: lex_wide_string.c,v 1.4 2023/03/28 14:44:34 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 /* lint1-extra-flags: -X 351 */
11 
12 void sink(const int *);
13 
14 void
15 test(void)
16 {
17 	sink(L"");
18 
19 	sink(L"hello, world\n");
20 
21 	sink(L"\0");
22 
23 	sink(L"\0\0\0\0");
24 
25 	/* expect+1: error: no hex digits follow \x [74] */
26 	sink(L"\x");
27 
28 	/* expect+1: warning: dubious escape \y [79] */
29 	sink(L"\y");
30 
31 	sink(L"first" L"second");
32 
33 	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
34 	sink(L"wide" "plain");
35 }
36