summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/lex_wide_string.c
blob: 48c06d1aa6b3f958b9fa7b585607e13efc4d8723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*	$NetBSD: lex_wide_string.c,v 1.4 2023/03/28 14:44:34 rillig Exp $	*/
# 3 "lex_wide_string.c"

/*
 * Test lexical analysis of wide string constants.
 *
 * C99 6.4.5 "String literals"
 */

/* lint1-extra-flags: -X 351 */

void sink(const int *);

void
test(void)
{
	sink(L"");

	sink(L"hello, world\n");

	sink(L"\0");

	sink(L"\0\0\0\0");

	/* expect+1: error: no hex digits follow \x [74] */
	sink(L"\x");

	/* expect+1: warning: dubious escape \y [79] */
	sink(L"\y");

	sink(L"first" L"second");

	/* expect+1: error: cannot concatenate wide and regular string literals [292] */
	sink(L"wide" "plain");
}