Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: disable test for messa...



details:   https://anonhg.NetBSD.org/src/rev/c30e8138d4fa
branches:  trunk
changeset: 985504:c30e8138d4fa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 28 18:40:15 2021 +0000

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

diffstat:

 tests/usr.bin/xlint/lint1/msg_252.c   |  24 +++++++++++++++++++++++-
 tests/usr.bin/xlint/lint1/msg_252.exp |   2 +-
 2 files changed, 24 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 2c0c671984be -r c30e8138d4fa tests/usr.bin/xlint/lint1/msg_252.c
--- a/tests/usr.bin/xlint/lint1/msg_252.c       Sat Aug 28 17:18:42 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_252.c       Sat Aug 28 18:40:15 2021 +0000
@@ -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;
diff -r 2c0c671984be -r c30e8138d4fa tests/usr.bin/xlint/lint1/msg_252.exp
--- a/tests/usr.bin/xlint/lint1/msg_252.exp     Sat Aug 28 17:18:42 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_252.exp     Sat Aug 28 18:40:15 2021 +0000
@@ -1,1 +1,1 @@
-msg_252.c(7): warning: integer constant out of range [252]
+msg_252.c(29): warning: integer constant out of range [252]



Home | Main Index | Thread Index | Old Index