Module Name:    src
Committed By:   rillig
Date:           Fri Feb  2 19:07:58 UTC 2024

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/usr.bin/xlint/lint1: lex_char.c msg_074.c msg_075.c msg_076.c
            msg_079.c msg_080.c msg_081.c msg_082.c msg_254.c msg_258.c
            msg_263.c msg_264.c queries.c
Added Files:
        src/tests/usr.bin/xlint/lint1: msg_079_nongcc.c

Log Message:
tests/lint: test lexing of characters and strings


To generate a diff of this commit:
cvs rdiff -u -r1.1302 -r1.1303 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/lex_char.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_074.c \
    src/tests/usr.bin/xlint/lint1/msg_075.c \
    src/tests/usr.bin/xlint/lint1/msg_080.c \
    src/tests/usr.bin/xlint/lint1/msg_081.c \
    src/tests/usr.bin/xlint/lint1/msg_082.c \
    src/tests/usr.bin/xlint/lint1/msg_258.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_076.c \
    src/tests/usr.bin/xlint/lint1/msg_079.c \
    src/tests/usr.bin/xlint/lint1/msg_254.c \
    src/tests/usr.bin/xlint/lint1/msg_263.c
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_079_nongcc.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_264.c
cvs rdiff -u -r1.23 -r1.24 src/tests/usr.bin/xlint/lint1/queries.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1302 src/distrib/sets/lists/tests/mi:1.1303
--- src/distrib/sets/lists/tests/mi:1.1302	Sat Jan 27 15:10:56 2024
+++ src/distrib/sets/lists/tests/mi	Fri Feb  2 19:07:57 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1302 2024/01/27 15:10:56 rillig Exp $
+# $NetBSD: mi,v 1.1303 2024/02/02 19:07:57 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6905,6 +6905,7 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_078.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_079.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_079.exp			tests-obsolete		obsolete,atf
+./usr/tests/usr.bin/xlint/lint1/msg_079_nongcc.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_080.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_080.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_081.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/lex_char.c
diff -u src/tests/usr.bin/xlint/lint1/lex_char.c:1.8 src/tests/usr.bin/xlint/lint1/lex_char.c:1.9
--- src/tests/usr.bin/xlint/lint1/lex_char.c:1.8	Fri Jan 19 19:23:34 2024
+++ src/tests/usr.bin/xlint/lint1/lex_char.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex_char.c,v 1.8 2024/01/19 19:23:34 rillig Exp $	*/
+/*	$NetBSD: lex_char.c,v 1.9 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "lex_char.c"
 
 /*
@@ -61,6 +61,18 @@ test(void)
 
 	/* U+000D carriage return */
 	sink('\r');
+
+	/* A double quote may be escaped or not, since C90. */
+	sink('"');
+	sink('\"');
+
+	/* A question mark may be escaped or not, since C90. */
+	sink('?');
+	sink('\?');
+
+	sink('\\');
+
+	sink('\'');
 }
 
 /*

Index: src/tests/usr.bin/xlint/lint1/msg_074.c
diff -u src/tests/usr.bin/xlint/lint1/msg_074.c:1.6 src/tests/usr.bin/xlint/lint1/msg_074.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_074.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_074.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_074.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_074.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_074.c"
 
 // Test for message: no hex digits follow \x [74]
@@ -6,11 +6,31 @@
 /* lint1-extra-flags: -X 351 */
 
 /* expect+1: error: no hex digits follow \x [74] */
-char invalid_hex = '\x';
-
+char char_invalid_hex = '\x';
 /* expect+2: error: no hex digits follow \x [74] */
 /* expect+1: warning: multi-character character constant [294] */
-char invalid_hex_letter = '\xg';
+char char_invalid_hex_letter = '\xg';
+char char_hex1 = '\xf';
+char char_hex2 = '\xff';
 
-char valid_hex = '\xff';
-char valid_single_digit_hex = '\xa';
+/* 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.6 src/tests/usr.bin/xlint/lint1/msg_075.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_075.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_075.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_075.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_075.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_075.c"
 
 // Test for message: overflow in hex escape [75]
@@ -19,3 +19,47 @@ char str[] = "\x123456781234567812345678
 
 /* C11 6.4.4.4p7 */
 char leading_zeroes = '\x0000000000000000000000000000020';
+
+char char_hex1 = '\xf';
+char char_hex2 = '\xff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex3 = '\x100';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex4 = '\xffff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex5 = '\xfffff';
+/* expect+1: warning: overflow in hex escape [75] */
+char char_hex9 = '\xfffffffff';
+
+int wide_hex1 = L'\xf';
+int wide_hex2 = L'\xff';
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_hex3 = L'\x100';
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_hex4 = L'\xffff';
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_hex5 = L'\xfffff';
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_hex9 = L'\xfffffffff';
+
+char char_string_hex1[] = "\xf";
+char char_string_hex2[] = "\xff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex3[] = "\x100";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex4[] = "\xffff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex5[] = "\xfffff";
+/* expect+1: warning: overflow in hex escape [75] */
+char char_string_hex9[] = "\xfffffffff";
+
+int wide_string_hex1[] = L"\xf";
+int wide_string_hex2[] = L"\xff";
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_string_hex3[] = L"\x100";
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_string_hex4[] = L"\xffff";
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_string_hex5[] = L"\xfffff";
+/* expect+1: warning: overflow in hex escape [75] */
+int wide_string_hex9[] = L"\xfffffffff";
Index: src/tests/usr.bin/xlint/lint1/msg_080.c
diff -u src/tests/usr.bin/xlint/lint1/msg_080.c:1.6 src/tests/usr.bin/xlint/lint1/msg_080.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_080.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_080.c	Fri Feb  2 19:07:58 2024
@@ -1,9 +1,24 @@
-/*	$NetBSD: msg_080.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_080.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_080.c"
 
 // Test for message: dubious escape \%o [80]
 
 /* lint1-extra-flags: -X 351 */
 
+/* expect+1: warning: dubious escape \11 [80] */
+char char_backslash_tab = '\	';
 /* expect+1: warning: dubious escape \177 [80] */
-char backslash_delete = '\';
+char char_backslash_delete = '\';
+/* expect+1: warning: dubious escape \11 [80] */
+int wide_backslash_tab = L'\	';
+/* expect+1: warning: dubious escape \177 [80] */
+int wide_backslash_delete = L'\';
+
+/* expect+1: warning: dubious escape \11 [80] */
+char char_string_backslash_tab[] = "\	";
+/* expect+1: warning: dubious escape \177 [80] */
+char char_string_backslash_delete[] = "\";
+/* expect+1: warning: dubious escape \11 [80] */
+int wide_string_backslash_tab[] = L"\	";
+/* expect+1: warning: dubious escape \177 [80] */
+int wide_string_backslash_delete[] = L"\";
Index: src/tests/usr.bin/xlint/lint1/msg_081.c
diff -u src/tests/usr.bin/xlint/lint1/msg_081.c:1.6 src/tests/usr.bin/xlint/lint1/msg_081.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_081.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_081.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_081.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_081.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_081.c"
 
 /* Test for message: \a undefined in traditional C [81] */
@@ -6,4 +6,6 @@
 /* lint1-flags: -tw -X 351 */
 
 /* expect+1: warning: \a undefined in traditional C [81] */
-char str[] = "The bell\a rings";
+char char_a = '\a';
+/* expect+1: warning: \a undefined in traditional C [81] */
+char char_string_a[] = "The bell\a rings";
Index: src/tests/usr.bin/xlint/lint1/msg_082.c
diff -u src/tests/usr.bin/xlint/lint1/msg_082.c:1.6 src/tests/usr.bin/xlint/lint1/msg_082.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_082.c:1.6	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_082.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_082.c,v 1.6 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_082.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_082.c"
 
 /* Test for message: \x undefined in traditional C [82] */
@@ -6,4 +6,6 @@
 /* lint1-flags: -Stw -X 351 */
 
 /* expect+1: warning: \x undefined in traditional C [82] */
-char str[] = "A he\x78 escape";
+char char_hex = '\x78';
+/* expect+1: warning: \x undefined in traditional C [82] */
+char char_string_hex[] = "\x78";
Index: src/tests/usr.bin/xlint/lint1/msg_258.c
diff -u src/tests/usr.bin/xlint/lint1/msg_258.c:1.6 src/tests/usr.bin/xlint/lint1/msg_258.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_258.c:1.6	Fri Feb  2 16:05:37 2024
+++ src/tests/usr.bin/xlint/lint1/msg_258.c	Fri Feb  2 19:07:58 2024
@@ -1,19 +1,23 @@
-/*	$NetBSD: msg_258.c,v 1.6 2024/02/02 16:05:37 rillig Exp $	*/
+/*	$NetBSD: msg_258.c,v 1.7 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_258.c"
 
 // Test for message: unterminated string constant [258]
 
 /* lint1-extra-flags: -X 351 */
 
-int dummy;
-
-// A string literal that is not finished at the end of the line confuses the
-// parser.
-//
-// "This string doesn't end in this line.
-
-/* expect+5: error: newline in string or char constant [254] */
-/* expect+4: error: unterminated string constant [258] */
-/* expect+3: error: syntax error '' [249] */
-/* expect+2: error: empty array declaration for 'str' [190] */
-const char str[] = "This is the end.
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated character constant [253] */
+char char_incomplete = 'x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated string constant [258] */
+char char_string_incomplete[] = "x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated character constant [253] */
+int wide_incomplete = L'x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated string constant [258] */
+int wide_string_incomplete[] = L"x
+;

Index: src/tests/usr.bin/xlint/lint1/msg_076.c
diff -u src/tests/usr.bin/xlint/lint1/msg_076.c:1.5 src/tests/usr.bin/xlint/lint1/msg_076.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_076.c:1.5	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_076.c	Fri Feb  2 19:07:58 2024
@@ -1,9 +1,23 @@
-/*	$NetBSD: msg_076.c,v 1.5 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: msg_076.c,v 1.6 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_076.c"
 
 // Test for message: character escape does not fit in character [76]
 
 /* lint1-extra-flags: -X 351 */
 
+char char_255 = '\377';
 /* expect+1: warning: character escape does not fit in character [76] */
-char ch = '\777';
+char char_256 = '\400';
+/* expect+1: warning: character escape does not fit in character [76] */
+char char_511 = '\777';
+/* expect+2: warning: multi-character character constant [294] */
+/* expect+1: warning: initializer does not fit [178] */
+char char_512 = '\1000';
+
+int wide_255 = L'\377';
+/* expect+1: warning: character escape does not fit in character [76] */
+int wide_256 = L'\400';
+/* expect+1: warning: character escape does not fit in character [76] */
+int wide_511 = L'\777';
+/* expect+1: error: too many characters in character constant [71] */
+int wide_512 = L'\1000';
Index: src/tests/usr.bin/xlint/lint1/msg_079.c
diff -u src/tests/usr.bin/xlint/lint1/msg_079.c:1.5 src/tests/usr.bin/xlint/lint1/msg_079.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_079.c:1.5	Fri Jan 19 19:23:34 2024
+++ src/tests/usr.bin/xlint/lint1/msg_079.c	Fri Feb  2 19:07:58 2024
@@ -1,16 +1,22 @@
-/*	$NetBSD: msg_079.c,v 1.5 2024/01/19 19:23:34 rillig Exp $	*/
+/*	$NetBSD: msg_079.c,v 1.6 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_079.c"
 
 // Test for message: dubious escape \%c [79]
 
+/* \e is only accepted in GCC mode. */
+
 /* lint1-extra-flags: -X 351 */
 
-int my_printf(const char *, ...);
+char char_e = '\e';
+/* expect+1: warning: dubious escape \y [79] */
+char char_y = '\y';
+int wide_e = L'\e';
+/* expect+1: warning: dubious escape \y [79] */
+int wide_y = L'\y';
 
-void
-print_color(_Bool red, _Bool green, _Bool blue)
-{
-	/* expect+1: warning: dubious escape \y [79] */
-	my_printf("\e[%dm\y",
-	    30 + (red ? 1 : 0) + (green ? 2 : 0) + (blue ? 4 : 0));
-}
+char char_string_e[] = "\e[0m";
+/* expect+1: warning: dubious escape \y [79] */
+char char_string_y[] = "\y[0m";
+int wide_string_e[] = L"\e[0m";
+/* expect+1: warning: dubious escape \y [79] */
+int wide_string_y[] = L"\y[0m";
Index: src/tests/usr.bin/xlint/lint1/msg_254.c
diff -u src/tests/usr.bin/xlint/lint1/msg_254.c:1.5 src/tests/usr.bin/xlint/lint1/msg_254.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_254.c:1.5	Fri Feb  2 16:25:58 2024
+++ src/tests/usr.bin/xlint/lint1/msg_254.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_254.c,v 1.5 2024/02/02 16:25:58 rillig Exp $	*/
+/*	$NetBSD: msg_254.c,v 1.6 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_254.c"
 
 /* Test for message: newline in string or char constant [254] */
@@ -6,14 +6,22 @@
 /* lint1-flags: -tw -q17 */
 
 /*
- * The sequence backslash-newline is a GCC extension.
- * C99 does not allow it.
+ * A literal newline must not occur in a character constant or string literal.
  */
 
-/* expect+6: error: newline in string or char constant [254] */
-/* expect+5: error: unterminated string constant [258] */
-/* expect+4: error: syntax error '"' [249] */
-/* expect+4: error: newline in string or char constant [254] */
-/* expect+3: error: unterminated string constant [258] */
-"line1
-line2"
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated character constant [253] */
+char char_incomplete = 'x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated string constant [258] */
+char char_string_incomplete[] = "x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated character constant [253] */
+int wide_incomplete = L'x
+;
+/* expect+3: error: newline in string or char constant [254] */
+/* expect+2: error: unterminated string constant [258] */
+int wide_string_incomplete[] = L"x
+;
Index: src/tests/usr.bin/xlint/lint1/msg_263.c
diff -u src/tests/usr.bin/xlint/lint1/msg_263.c:1.5 src/tests/usr.bin/xlint/lint1/msg_263.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_263.c:1.5	Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_263.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_263.c,v 1.5 2023/03/28 14:44:35 rillig Exp $	*/
+/*	$NetBSD: msg_263.c,v 1.6 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_263.c"
 
 /* Test for message: \? undefined in traditional C [263] */
@@ -7,3 +7,5 @@
 
 /* expect+1: warning: \? undefined in traditional C [263] */
 char ch = '\?';
+/* expect+1: warning: \? undefined in traditional C [263] */
+char str[] = "Hello\?";

Index: src/tests/usr.bin/xlint/lint1/msg_264.c
diff -u src/tests/usr.bin/xlint/lint1/msg_264.c:1.4 src/tests/usr.bin/xlint/lint1/msg_264.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_264.c:1.4	Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_264.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_264.c,v 1.4 2023/03/28 14:44:35 rillig Exp $	*/
+/*	$NetBSD: msg_264.c,v 1.5 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "msg_264.c"
 
 /* Test for message: \v undefined in traditional C [264] */
@@ -6,4 +6,6 @@
 /* lint1-flags: -tw -X 351 */
 
 /* expect+1: warning: \v undefined in traditional C [264] */
+char ch = '\v';
+/* expect+1: warning: \v undefined in traditional C [264] */
 char str[] = "vertical \v tab";

Index: src/tests/usr.bin/xlint/lint1/queries.c
diff -u src/tests/usr.bin/xlint/lint1/queries.c:1.23 src/tests/usr.bin/xlint/lint1/queries.c:1.24
--- src/tests/usr.bin/xlint/lint1/queries.c:1.23	Sun Jan 28 08:54:27 2024
+++ src/tests/usr.bin/xlint/lint1/queries.c	Fri Feb  2 19:07:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: queries.c,v 1.23 2024/01/28 08:54:27 rillig Exp $	*/
+/*	$NetBSD: queries.c,v 1.24 2024/02/02 19:07:58 rillig Exp $	*/
 # 3 "queries.c"
 
 /*
@@ -462,7 +462,11 @@ Q16(void)
 /* expect+1: invisible character U+0009 in character constant [Q17] */
 char Q17_char[] = { ' ', '\0', '	' };
 /* expect+1: invisible character U+0009 in string literal [Q17] */
-char Q17_string[] = " \0	";
+char Q17_char_string[] = " \0	";
+/* expect+1: invisible character U+0009 in character constant [Q17] */
+int Q17_wide[] = { L' ', L'\0', L'	' };
+/* expect+1: invisible character U+0009 in string literal [Q17] */
+int Q17_wide_string[] = L" \0	";
 
 /* For Q18, see queries_schar.c and queries_uchar.c. */
 

Added files:

Index: src/tests/usr.bin/xlint/lint1/msg_079_nongcc.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_079_nongcc.c:1.1
--- /dev/null	Fri Feb  2 19:07:58 2024
+++ src/tests/usr.bin/xlint/lint1/msg_079_nongcc.c	Fri Feb  2 19:07:58 2024
@@ -0,0 +1,26 @@
+/*	$NetBSD: msg_079_nongcc.c,v 1.1 2024/02/02 19:07:58 rillig Exp $	*/
+# 3 "msg_079_nongcc.c"
+
+// Test for message: dubious escape \%c [79]
+
+/* \e is only accepted in GCC mode. */
+
+/* lint1-flags: -S -w -X 351 */
+
+/* expect+1: warning: dubious escape \e [79] */
+char char_e = '\e';
+/* expect+1: warning: dubious escape \y [79] */
+char char_y = '\y';
+/* expect+1: warning: dubious escape \e [79] */
+int wide_e = L'\e';
+/* expect+1: warning: dubious escape \y [79] */
+int wide_y = L'\y';
+
+/* expect+1: warning: dubious escape \e [79] */
+char char_string_e[] = "\e[0m";
+/* expect+1: warning: dubious escape \y [79] */
+char char_string_y[] = "\y[0m";
+/* expect+1: warning: dubious escape \e [79] */
+int wide_string_e[] = L"\e[0m";
+/* expect+1: warning: dubious escape \y [79] */
+int wide_string_y[] = L"\y[0m";

Reply via email to