Module Name:    src
Committed By:   rillig
Date:           Sat Aug 28 18:40:15 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_252.c msg_252.exp

Log Message:
tests/lint: disable test for message 252 on ILP32 platforms


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_252.c \
    src/tests/usr.bin/xlint/lint1/msg_252.exp

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_252.c
diff -u src/tests/usr.bin/xlint/lint1/msg_252.c:1.3 src/tests/usr.bin/xlint/lint1/msg_252.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_252.c:1.3	Fri Aug 27 20:49:25 2021
+++ src/tests/usr.bin/xlint/lint1/msg_252.c	Sat Aug 28 18:40:15 2021
@@ -1,7 +1,29 @@
-/*	$NetBSD: msg_252.c,v 1.3 2021/08/27 20:49:25 rillig Exp $	*/
+/*	$NetBSD: msg_252.c,v 1.4 2021/08/28 18:40:15 rillig Exp $	*/
 # 3 "msg_252.c"
 
 // Test for message: integer constant out of range [252]
 
+/*
+ * On ILP32 platforms, lint additionally and unnecessarily warns:
+ *
+ *	conversion of 'unsigned long' to 'int' is out of range [119]
+ *
+ * On an ILP32 platform, lex_integer_constant interprets this number as
+ * having type ULONG, which is stored as 'ULONG 0x0000_0000_ffff_ffff'.
+ * This number is passed to convert_constant, which calls convert_integer,
+ * which sign-extends the number to 'INT 0xffff_ffff_ffff_ffff'.  This
+ * converted number is passed to convert_constant_check_range, and at this
+ * point, v->v_quad != nv->v_quad, due to the sign extension.  This triggers
+ * an additional warning 119.
+ *
+ * On a 64-bit platform, lex_integer_constant stores the number as
+ * 'ULONG 0xffff_ffff_ffff_ffff', which has the same representation as the
+ * 'INT 0xffff_ffff_ffff_ffff', therefore no warning.
+ *
+ * Due to this unnecessary difference, disable this test on ILP32 platforms
+ * for now (2021-08-28).
+ */
+/* lint1-skip-if: ilp32 */
+
 /* expect+1: warning: integer constant out of range [252] */
 int constant = 1111111111111111111111111111111111111111111111111111;
Index: src/tests/usr.bin/xlint/lint1/msg_252.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_252.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_252.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_252.exp:1.3	Fri Aug 27 20:49:25 2021
+++ src/tests/usr.bin/xlint/lint1/msg_252.exp	Sat Aug 28 18:40:15 2021
@@ -1 +1 @@
-msg_252.c(7): warning: integer constant out of range [252]
+msg_252.c(29): warning: integer constant out of range [252]

Reply via email to