blob: e912119f67cace48326b6bcd9af7a594aa804722 (
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
36
37
38
|
/* $NetBSD: lex_string.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */
# 3 "lex_string.c"
/*
* Test lexical analysis of string constants.
*
* C99 6.4.5 "String literals"
*/
/* lint1-extra-flags: -X 351 */
void sink(const char *);
void
test(void)
{
sink("");
sink("hello, world\n");
sink("\0");
sink("\0\0\0\0");
/* expect+1: error: no hex digits follow \x [74] */
sink("\x"); /* unfinished */
/* expect+1: warning: dubious escape \y [79] */
sink("\y"); /* unknown escape sequence */
sink("first" "second");
/* expect+1: error: cannot concatenate wide and regular string literals [292] */
sink("plain" L"wide");
}
/* TODO: test digraphs inside string literals */
/* TODO: test trigraphs inside string literals */
|