Module Name: src
Committed By: rillig
Date: Sat Aug 21 11:58:12 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_259.c msg_259.exp
Log Message:
tests/lint: add more test cases for lossy integer conversion
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_259.c
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_259.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_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.11 src/tests/usr.bin/xlint/lint1/msg_259.c:1.12
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.11 Sat Aug 21 11:50:57 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c Sat Aug 21 11:58:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_259.c,v 1.11 2021/08/21 11:50:57 rillig Exp $ */
+/* $NetBSD: msg_259.c,v 1.12 2021/08/21 11:58:12 rillig Exp $ */
# 3 "msg_259.c"
// Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
@@ -52,4 +52,19 @@ convert_to_corresponding_unsigned(int i,
/* TODO: don't warn here. */
/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259] */
farg_unsigned_long_long(ll);
+
+ /*
+ * XXX: Why no warning? Even though 'unsigned long' is 64 bits
+ * wide, it cannot represent negative 32-bit values.
+ */
+ farg_unsigned_long(i);
+
+ /*
+ * XXX: Why no warning? Even though 'unsigned long long' is 64 bits
+ * wide, it cannot represent negative 32-bit values.
+ */
+ farg_unsigned_long_long(i);
+
+ /* expect+1: warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259] */
+ farg_unsigned_long_long(l);
}
Index: src/tests/usr.bin/xlint/lint1/msg_259.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_259.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_259.exp:1.9
--- src/tests/usr.bin/xlint/lint1/msg_259.exp:1.8 Sat Aug 21 11:19:38 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.exp Sat Aug 21 11:58:12 2021
@@ -2,3 +2,4 @@ msg_259.c(28): warning: argument #1 is c
msg_259.c(46): warning: argument #1 is converted from 'int' to 'unsigned int' due to prototype [259]
msg_259.c(50): warning: argument #1 is converted from 'long' to 'unsigned long' due to prototype [259]
msg_259.c(54): warning: argument #1 is converted from 'long long' to 'unsigned long long' due to prototype [259]
+msg_259.c(69): warning: argument #1 is converted from 'long' to 'unsigned long long' due to prototype [259]