xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_075.c (revision 2b097c752f58a0584539f0e0502d7510f91a5d8e)
1 /*	$NetBSD: msg_075.c,v 1.10 2024/02/03 19:18:36 rillig Exp $	*/
2 # 3 "msg_075.c"
3 
4 // Test for message: overflow in hex escape [75]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 /*
9  * See also:
10  *	lex_char.c
11  *	lex_char_uchar.c
12  *	lex_string.c
13  *	lex_wide_char.c
14  *	lex_wide_string.c
15  */
16 
17 /* expect+1: warning: overflow in hex escape [75] */
18 char str[] = "\x12345678123456781234567812345678";
19 
20 /* C11 6.4.4.4p7 */
21 char leading_zeroes = '\x0000000000000000000000000000020';
22 
23 char char_hex4bit = '\xf';
24 char char_hex7bit = '\x7f';
25 char char_hex8bit = '\xff';
26 /* expect+1: warning: overflow in hex escape [75] */
27 char char_hex9bit = '\x100';
28 /* expect+1: warning: overflow in hex escape [75] */
29 char char_hex16bit = '\xffff';
30 /* expect+1: warning: overflow in hex escape [75] */
31 char char_hex20bit = '\xfffff';
32 /* expect+1: warning: overflow in hex escape [75] */
33 char char_hex31bit = '\x7fffffff';
34 /* expect+1: warning: overflow in hex escape [75] */
35 char char_hex32bit = '\xffffffff';
36 /* expect+1: warning: overflow in hex escape [75] */
37 char char_hex33bit = '\x1000000ff';
38 /* expect+1: warning: overflow in hex escape [75] */
39 char char_hex36bit = '\xfffffffff';
40 
41 int wide_hex4bit = L'\xf';
42 int wide_hex7bit = L'\x7f';
43 int wide_hex8bit = L'\xff';
44 int wide_hex9bit = L'\x100';
45 int wide_hex16bit = L'\xffff';
46 int wide_hex20bit = L'\xfffff';
47 int wide_hex31bit = L'\x7fffffff';
48 int wide_hex32bit = L'\xffffffff';
49 /* expect+1: warning: overflow in hex escape [75] */
50 int wide_hex33bit = L'\x1000000ff';
51 /* expect+1: warning: overflow in hex escape [75] */
52 int wide_hex36bit = L'\xfffffffff';
53 
54 char char_string_hex4bit[] = "\xf";
55 char char_string_hex7bit[] = "\x7f";
56 char char_string_hex8bit[] = "\xff";
57 /* expect+1: warning: overflow in hex escape [75] */
58 char char_string_hex9bit[] = "\x100";
59 /* expect+1: warning: overflow in hex escape [75] */
60 char char_string_hex16bit[] = "\xffff";
61 /* expect+1: warning: overflow in hex escape [75] */
62 char char_string_hex20bit[] = "\xfffff";
63 /* expect+1: warning: overflow in hex escape [75] */
64 char char_string_hex31bit[] = "\x7fffffff";
65 /* expect+1: warning: overflow in hex escape [75] */
66 char char_string_hex32bit[] = "\xffffffff";
67 /* expect+1: warning: overflow in hex escape [75] */
68 char char_string_hex33bit[] = "\x1000000ff";
69 /* expect+1: warning: overflow in hex escape [75] */
70 char char_string_hex36[] = "\xfffffffff";
71 
72 int wide_string_hex4bit[] = L"\xf";
73 int wide_string_hex7bit[] = L"\x7f";
74 int wide_string_hex8bit[] = L"\xff";
75 int wide_string_hex9bit[] = L"\x100";
76 int wide_string_hex16bit[] = L"\xffff";
77 int wide_string_hex20bit[] = L"\xfffff";
78 int wide_string_hex31bit[] = L"\x7fffffff";
79 int wide_string_hex32bit[] = L"\xffffffff";
80 /* expect+1: warning: overflow in hex escape [75] */
81 int wide_string_hex33bit[] = L"\x1000000ff";
82 /* expect+1: warning: overflow in hex escape [75] */
83 int wide_string_hex36bit[] = L"\xfffffffff";
84