Module Name: src
Committed By: rillig
Date: Sat Feb 3 19:18:36 UTC 2024
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_074.c msg_075.c
Log Message:
tests/lint: extend tests for hexadecimal character escapes
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_074.c
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_075.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/msg_074.c
diff -u src/tests/usr.bin/xlint/lint1/msg_074.c:1.7 src/tests/usr.bin/xlint/lint1/msg_074.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_074.c:1.7 Fri Feb 2 19:07:58 2024
+++ src/tests/usr.bin/xlint/lint1/msg_074.c Sat Feb 3 19:18:36 2024
@@ -1,7 +1,10 @@
-/* $NetBSD: msg_074.c,v 1.7 2024/02/02 19:07:58 rillig Exp $ */
+/* $NetBSD: msg_074.c,v 1.8 2024/02/03 19:18:36 rillig Exp $ */
# 3 "msg_074.c"
// Test for message: no hex digits follow \x [74]
+//
+// See also:
+// msg_075.c overflow in hex escape
/* lint1-extra-flags: -X 351 */
@@ -10,27 +13,19 @@ char char_invalid_hex = '\x';
/* expect+2: error: no hex digits follow \x [74] */
/* expect+1: warning: multi-character character constant [294] */
char char_invalid_hex_letter = '\xg';
-char char_hex1 = '\xf';
-char char_hex2 = '\xff';
/* expect+1: error: no hex digits follow \x [74] */
int wide_invalid_hex = L'\x';
/* expect+2: error: no hex digits follow \x [74] */
/* expect+1: error: too many characters in character constant [71] */
int wide_invalid_hex_letter = L'\xg';
-int wide_hex1 = L'\xf';
-int wide_hex2 = L'\xff';
/* expect+1: error: no hex digits follow \x [74] */
char char_string_invalid_hex[] = "\x";
/* expect+1: error: no hex digits follow \x [74] */
char char_string_invalid_hex_letter[] = "\xg";
-char char_string_hex1[] = "\xf";
-char char_string_hex2[] = "\xff";
/* expect+1: error: no hex digits follow \x [74] */
int wide_string_invalid_hex[] = L"\x";
/* expect+1: error: no hex digits follow \x [74] */
int wide_string_invalid_hex_letter[] = L"\xg";
-int wide_string_hex1[] = L"\xf";
-int wide_string_hex2[] = L"\xff";
Index: src/tests/usr.bin/xlint/lint1/msg_075.c
diff -u src/tests/usr.bin/xlint/lint1/msg_075.c:1.9 src/tests/usr.bin/xlint/lint1/msg_075.c:1.10
--- src/tests/usr.bin/xlint/lint1/msg_075.c:1.9 Sat Feb 3 18:58:05 2024
+++ src/tests/usr.bin/xlint/lint1/msg_075.c Sat Feb 3 19:18:36 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_075.c,v 1.9 2024/02/03 18:58:05 rillig Exp $ */
+/* $NetBSD: msg_075.c,v 1.10 2024/02/03 19:18:36 rillig Exp $ */
# 3 "msg_075.c"
// Test for message: overflow in hex escape [75]
@@ -20,40 +20,64 @@ char str[] = "\x123456781234567812345678
/* C11 6.4.4.4p7 */
char leading_zeroes = '\x0000000000000000000000000000020';
-char char_hex1 = '\xf';
-char char_hex2 = '\xff';
+char char_hex4bit = '\xf';
+char char_hex7bit = '\x7f';
+char char_hex8bit = '\xff';
/* expect+1: warning: overflow in hex escape [75] */
-char char_hex3 = '\x100';
+char char_hex9bit = '\x100';
/* expect+1: warning: overflow in hex escape [75] */
-char char_hex4 = '\xffff';
+char char_hex16bit = '\xffff';
/* expect+1: warning: overflow in hex escape [75] */
-char char_hex5 = '\xfffff';
+char char_hex20bit = '\xfffff';
/* expect+1: warning: overflow in hex escape [75] */
-char char_hex9 = '\xfffffffff';
+char char_hex31bit = '\x7fffffff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex32bit = '\xffffffff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex33bit = '\x1000000ff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex36bit = '\xfffffffff';
-int wide_hex1 = L'\xf';
-int wide_hex2 = L'\xff';
-int wide_hex3 = L'\x100';
-int wide_hex4 = L'\xffff';
-int wide_hex5 = L'\xfffff';
+int wide_hex4bit = L'\xf';
+int wide_hex7bit = L'\x7f';
+int wide_hex8bit = L'\xff';
+int wide_hex9bit = L'\x100';
+int wide_hex16bit = L'\xffff';
+int wide_hex20bit = L'\xfffff';
+int wide_hex31bit = L'\x7fffffff';
+int wide_hex32bit = L'\xffffffff';
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_hex33bit = L'\x1000000ff';
/* expect+1: warning: overflow in hex escape [75] */
-int wide_hex9 = L'\xfffffffff';
+int wide_hex36bit = L'\xfffffffff';
-char char_string_hex1[] = "\xf";
-char char_string_hex2[] = "\xff";
+char char_string_hex4bit[] = "\xf";
+char char_string_hex7bit[] = "\x7f";
+char char_string_hex8bit[] = "\xff";
/* expect+1: warning: overflow in hex escape [75] */
-char char_string_hex3[] = "\x100";
+char char_string_hex9bit[] = "\x100";
/* expect+1: warning: overflow in hex escape [75] */
-char char_string_hex4[] = "\xffff";
+char char_string_hex16bit[] = "\xffff";
/* expect+1: warning: overflow in hex escape [75] */
-char char_string_hex5[] = "\xfffff";
+char char_string_hex20bit[] = "\xfffff";
/* expect+1: warning: overflow in hex escape [75] */
-char char_string_hex9[] = "\xfffffffff";
+char char_string_hex31bit[] = "\x7fffffff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex32bit[] = "\xffffffff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex33bit[] = "\x1000000ff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex36[] = "\xfffffffff";
-int wide_string_hex1[] = L"\xf";
-int wide_string_hex2[] = L"\xff";
-int wide_string_hex3[] = L"\x100";
-int wide_string_hex4[] = L"\xffff";
-int wide_string_hex5[] = L"\xfffff";
+int wide_string_hex4bit[] = L"\xf";
+int wide_string_hex7bit[] = L"\x7f";
+int wide_string_hex8bit[] = L"\xff";
+int wide_string_hex9bit[] = L"\x100";
+int wide_string_hex16bit[] = L"\xffff";
+int wide_string_hex20bit[] = L"\xfffff";
+int wide_string_hex31bit[] = L"\x7fffffff";
+int wide_string_hex32bit[] = L"\xffffffff";
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_string_hex33bit[] = L"\x1000000ff";
/* expect+1: warning: overflow in hex escape [75] */
-int wide_string_hex9[] = L"\xfffffffff";
+int wide_string_hex36bit[] = L"\xfffffffff";