Module Name:    src
Committed By:   rillig
Date:           Fri Feb  2 23:30:39 UTC 2024

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/usr.bin/xlint/lint1: t_integration.sh
Added Files:
        src/tests/usr.bin/xlint/lint1: lex_utf8.c

Log Message:
tests/lint: test UTF-8 mode


To generate a diff of this commit:
cvs rdiff -u -r1.1303 -r1.1304 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/lex_utf8.c
cvs rdiff -u -r1.82 -r1.83 src/tests/usr.bin/xlint/lint1/t_integration.sh

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.1303 src/distrib/sets/lists/tests/mi:1.1304
--- src/distrib/sets/lists/tests/mi:1.1303	Fri Feb  2 19:07:57 2024
+++ src/distrib/sets/lists/tests/mi	Fri Feb  2 23:30:38 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1303 2024/02/02 19:07:57 rillig Exp $
+# $NetBSD: mi,v 1.1304 2024/02/02 23:30:38 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6735,6 +6735,7 @@
 ./usr/tests/usr.bin/xlint/lint1/lex_integer_ilp32.exp		tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_string.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_string.exp			tests-obsolete		obsolete,atf
+./usr/tests/usr.bin/xlint/lint1/lex_utf8.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_whitespace.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_whitespace.exp		tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/lex_wide_char.c			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.82 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.83
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.82	Wed Jul  5 11:42:14 2023
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Fri Feb  2 23:30:39 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.82 2023/07/05 11:42:14 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.83 2024/02/02 23:30:39 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -62,8 +62,6 @@ configure_test_case()
 		}
 
 		function platform_has(prop) {
-			if (platform[prop] != "")
-				return prop == archsubdir
 			if (!match(prop, /^(schar|uchar|ilp32|lp64|int|long|ldbl64|ldbl96|ldbl128)$/)) {
 				printf("bad property '\''%s'\''\n", prop) > "/dev/stderr"
 				exit(1)
@@ -109,6 +107,14 @@ configure_test_case()
 	local config
 	config="$(awk "$awk" "$1")" || exit 1
 	eval "$config"
+
+	case "_${1%.c}_" in
+	*_utf8_*)
+		LC_ALL=en_US.UTF-8;;
+	*)
+		LC_ALL=C;;
+	esac
+	export LC_ALL
 }
 
 # shellcheck disable=SC2155

Added files:

Index: src/tests/usr.bin/xlint/lint1/lex_utf8.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/lex_utf8.c:1.1
--- /dev/null	Fri Feb  2 23:30:39 2024
+++ src/tests/usr.bin/xlint/lint1/lex_utf8.c	Fri Feb  2 23:30:39 2024
@@ -0,0 +1,15 @@
+/*	$NetBSD: lex_utf8.c,v 1.1 2024/02/02 23:30:39 rillig Exp $	*/
+# 3 "lex_utf8.c"
+
+/*
+ * Test lexing of multibyte characters and strings in an UTF-8 locale.
+ */
+
+/*
+ * Since lint always runs in the default "C" locale, it does not support any
+ * multibyte character encoding, thus treating each byte as a separate
+ * character. If lint were to support UTF-8, the array dimension would be 3
+ * instead of 7.
+ */
+/* expect+1: error: negative array dimension (-7) [20] */
+typedef int mblen[-(int)(sizeof(L"Ä😄") / sizeof(L""))];

Reply via email to