Module Name: src
Committed By: rillig
Date: Thu Jan 7 18:37:41 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_006.c msg_006.exp msg_007.c
msg_007.exp msg_008.c msg_008.exp msg_009.c msg_009.exp msg_010.c
msg_010.exp msg_011.c msg_011.exp msg_180.c msg_180.exp msg_221.c
msg_221.exp
Log Message:
lint: add tests for some messages
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_006.c \
src/tests/usr.bin/xlint/lint1/msg_006.exp \
src/tests/usr.bin/xlint/lint1/msg_007.c \
src/tests/usr.bin/xlint/lint1/msg_007.exp \
src/tests/usr.bin/xlint/lint1/msg_008.c \
src/tests/usr.bin/xlint/lint1/msg_008.exp \
src/tests/usr.bin/xlint/lint1/msg_009.c \
src/tests/usr.bin/xlint/lint1/msg_009.exp \
src/tests/usr.bin/xlint/lint1/msg_010.c \
src/tests/usr.bin/xlint/lint1/msg_010.exp \
src/tests/usr.bin/xlint/lint1/msg_011.c \
src/tests/usr.bin/xlint/lint1/msg_011.exp \
src/tests/usr.bin/xlint/lint1/msg_180.c \
src/tests/usr.bin/xlint/lint1/msg_180.exp \
src/tests/usr.bin/xlint/lint1/msg_221.c \
src/tests/usr.bin/xlint/lint1/msg_221.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_006.c
diff -u src/tests/usr.bin/xlint/lint1/msg_006.c:1.1 src/tests/usr.bin/xlint/lint1/msg_006.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_006.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_006.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_006.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_006.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_006.c"
// Test for message: use 'double' instead of 'long float' [6]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+long float x;
+double x;
Index: src/tests/usr.bin/xlint/lint1/msg_006.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_006.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_006.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_006.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_006.exp Thu Jan 7 18:37:41 2021
@@ -1 +1,2 @@
-msg_006.c(6): syntax error ':' [249]
+msg_006.c(6): warning: use 'double' instead of 'long float' [6]
+msg_006.c(6): illegal type combination [4]
Index: src/tests/usr.bin/xlint/lint1/msg_007.c
diff -u src/tests/usr.bin/xlint/lint1/msg_007.c:1.1 src/tests/usr.bin/xlint/lint1/msg_007.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_007.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_007.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_007.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_007.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_007.c"
// Test for message: only one storage class allowed [7]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+extern static void example(void);
+extern extern_function(void);
Index: src/tests/usr.bin/xlint/lint1/msg_007.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_007.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_007.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_007.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_007.exp Thu Jan 7 18:37:41 2021
@@ -1 +1 @@
-msg_007.c(6): syntax error ':' [249]
+msg_007.c(6): only one storage class allowed [7]
Index: src/tests/usr.bin/xlint/lint1/msg_008.c
diff -u src/tests/usr.bin/xlint/lint1/msg_008.c:1.1 src/tests/usr.bin/xlint/lint1/msg_008.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_008.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_008.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,9 @@
-/* $NetBSD: msg_008.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_008.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_008.c"
// Test for message: illegal storage class [8]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+typedef void
+example(void)
+{
+}
Index: src/tests/usr.bin/xlint/lint1/msg_008.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_008.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_008.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_008.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_008.exp Thu Jan 7 18:37:41 2021
@@ -1 +1 @@
-msg_008.c(6): syntax error ':' [249]
+msg_008.c(8): illegal storage class [8]
Index: src/tests/usr.bin/xlint/lint1/msg_009.c
diff -u src/tests/usr.bin/xlint/lint1/msg_009.c:1.1 src/tests/usr.bin/xlint/lint1/msg_009.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_009.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_009.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,9 @@
-/* $NetBSD: msg_009.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_009.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_009.c"
// Test for message: only register valid as formal parameter storage class [9]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+extern void typedef_example(typedef int param);
+extern void auto_example(auto int param);
+extern void static_example(static int param);
+extern void extern_example(extern int param);
Index: src/tests/usr.bin/xlint/lint1/msg_009.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_009.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_009.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_009.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_009.exp Thu Jan 7 18:37:41 2021
@@ -1 +1,4 @@
-msg_009.c(6): syntax error ':' [249]
+msg_009.c(6): only register valid as formal parameter storage class [9]
+msg_009.c(7): only register valid as formal parameter storage class [9]
+msg_009.c(8): only register valid as formal parameter storage class [9]
+msg_009.c(9): only register valid as formal parameter storage class [9]
Index: src/tests/usr.bin/xlint/lint1/msg_010.c
diff -u src/tests/usr.bin/xlint/lint1/msg_010.c:1.1 src/tests/usr.bin/xlint/lint1/msg_010.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_010.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_010.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,21 @@
-/* $NetBSD: msg_010.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_010.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_010.c"
// Test for message: duplicate '%s' [10]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+inline inline void
+double_inline(void)
+{
+}
+
+const const int
+double_const(void)
+{
+ return 0;
+}
+
+volatile volatile int
+double_volatile(void)
+{
+ return 0;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_010.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_010.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_010.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_010.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_010.exp Thu Jan 7 18:37:41 2021
@@ -1 +1,3 @@
-msg_010.c(6): syntax error ':' [249]
+msg_010.c(6): warning: duplicate 'inline' [10]
+msg_010.c(11): warning: duplicate 'const' [10]
+msg_010.c(17): warning: duplicate 'volatile' [10]
Index: src/tests/usr.bin/xlint/lint1/msg_011.c
diff -u src/tests/usr.bin/xlint/lint1/msg_011.c:1.1 src/tests/usr.bin/xlint/lint1/msg_011.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_011.c:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_011.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,24 @@
-/* $NetBSD: msg_011.c,v 1.1 2021/01/02 10:22:42 rillig Exp $ */
+/* $NetBSD: msg_011.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_011.c"
// Test for message: bit-field initializer out of range [11]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+struct example {
+ int bit_field: 4;
+} example_var[] = {
+ { 2 },
+ { 1 + 1 },
+ { 1ULL << 40 },
+ { 1LL << 40 },
+ { -16 - 1 },
+};
+
+struct example_u {
+ unsigned int bit_field: 4;
+} example_var_u[] = {
+ { 2 },
+ { 1 + 1 },
+ { 1ULL << 40 },
+ { 1LL << 40 },
+ { -16 - 1 },
+};
Index: src/tests/usr.bin/xlint/lint1/msg_011.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_011.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_011.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_011.exp:1.1 Sat Jan 2 10:22:42 2021
+++ src/tests/usr.bin/xlint/lint1/msg_011.exp Thu Jan 7 18:37:41 2021
@@ -1 +1,6 @@
-msg_011.c(6): syntax error ':' [249]
+msg_011.c(11): warning: bit-field initializer does not fit [180]
+msg_011.c(12): warning: bit-field initializer does not fit [180]
+msg_011.c(13): warning: bit-field initializer does not fit [180]
+msg_011.c(21): warning: bit-field initializer does not fit [180]
+msg_011.c(22): warning: bit-field initializer does not fit [180]
+msg_011.c(23): warning: initialisation of unsigned with negative constant [221]
Index: src/tests/usr.bin/xlint/lint1/msg_180.c
diff -u src/tests/usr.bin/xlint/lint1/msg_180.c:1.1 src/tests/usr.bin/xlint/lint1/msg_180.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_180.c:1.1 Sat Jan 2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_180.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,12 @@
-/* $NetBSD: msg_180.c,v 1.1 2021/01/02 10:22:43 rillig Exp $ */
+/* $NetBSD: msg_180.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_180.c"
// Test for message: bit-field initializer does not fit [180]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+struct example {
+ unsigned int a: 5;
+ unsigned int b: 5;
+} example_var = {
+ 32,
+ 31
+};
Index: src/tests/usr.bin/xlint/lint1/msg_180.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_180.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_180.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_180.exp:1.1 Sat Jan 2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_180.exp Thu Jan 7 18:37:41 2021
@@ -1 +1 @@
-msg_180.c(6): syntax error ':' [249]
+msg_180.c(10): warning: bit-field initializer does not fit [180]
Index: src/tests/usr.bin/xlint/lint1/msg_221.c
diff -u src/tests/usr.bin/xlint/lint1/msg_221.c:1.1 src/tests/usr.bin/xlint/lint1/msg_221.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_221.c:1.1 Sat Jan 2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_221.c Thu Jan 7 18:37:41 2021
@@ -1,7 +1,12 @@
-/* $NetBSD: msg_221.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */
+/* $NetBSD: msg_221.c,v 1.2 2021/01/07 18:37:41 rillig Exp $ */
# 3 "msg_221.c"
// Test for message: initialisation of unsigned with negative constant [221]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+struct example {
+ unsigned int a: 5;
+ unsigned int b: 5;
+} example_var = {
+ -1,
+ 31
+};
Index: src/tests/usr.bin/xlint/lint1/msg_221.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_221.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_221.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_221.exp:1.1 Sat Jan 2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_221.exp Thu Jan 7 18:37:41 2021
@@ -1 +1 @@
-msg_221.c(6): syntax error ':' [249]
+msg_221.c(10): warning: initialisation of unsigned with negative constant [221]