Module Name:    src
Committed By:   rillig
Date:           Thu Jan  7 00:38:46 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_093.c msg_093.exp msg_094.c
            msg_094.exp msg_095.c msg_095.exp msg_096.c msg_096.exp msg_097.c
            msg_097.exp msg_098.c msg_098.exp msg_099.c msg_099.exp

Log Message:
lint: add tests for messages 93, 94, 95, 96, 97, 98, 99


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_093.c \
    src/tests/usr.bin/xlint/lint1/msg_093.exp \
    src/tests/usr.bin/xlint/lint1/msg_094.c \
    src/tests/usr.bin/xlint/lint1/msg_094.exp \
    src/tests/usr.bin/xlint/lint1/msg_095.c \
    src/tests/usr.bin/xlint/lint1/msg_095.exp \
    src/tests/usr.bin/xlint/lint1/msg_096.c \
    src/tests/usr.bin/xlint/lint1/msg_096.exp \
    src/tests/usr.bin/xlint/lint1/msg_097.c \
    src/tests/usr.bin/xlint/lint1/msg_097.exp \
    src/tests/usr.bin/xlint/lint1/msg_098.c \
    src/tests/usr.bin/xlint/lint1/msg_098.exp \
    src/tests/usr.bin/xlint/lint1/msg_099.c \
    src/tests/usr.bin/xlint/lint1/msg_099.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_093.c
diff -u src/tests/usr.bin/xlint/lint1/msg_093.c:1.1 src/tests/usr.bin/xlint/lint1/msg_093.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_093.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_093.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,12 @@
-/*	$NetBSD: msg_093.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_093.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_093.c"
 
 // Test for message: dubious static function at block level: %s [93]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+void
+example(void)
+{
+	static void nested(void);
+
+	nested();
+}
Index: src/tests/usr.bin/xlint/lint1/msg_093.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_093.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_093.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_093.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_093.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1 @@
-msg_093.c(6): syntax error ':' [249]
+msg_093.c(9): warning: dubious static function at block level: nested [93]
Index: src/tests/usr.bin/xlint/lint1/msg_094.c
diff -u src/tests/usr.bin/xlint/lint1/msg_094.c:1.1 src/tests/usr.bin/xlint/lint1/msg_094.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_094.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_094.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,12 @@
-/*	$NetBSD: msg_094.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_094.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_094.c"
 
 // Test for message: function has illegal storage class: %s [94]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+register int
+global_example(int arg)
+{
+	register int register_example(int);
+
+	return arg;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_094.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_094.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_094.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_094.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_094.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1,2 @@
-msg_094.c(6): syntax error ':' [249]
+msg_094.c(7): illegal storage class [8]
+msg_094.c(9): function has illegal storage class: register_example [94]
Index: src/tests/usr.bin/xlint/lint1/msg_095.c
diff -u src/tests/usr.bin/xlint/lint1/msg_095.c:1.1 src/tests/usr.bin/xlint/lint1/msg_095.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_095.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_095.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,19 @@
-/*	$NetBSD: msg_095.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_095.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_095.c"
 
 // Test for message: declaration hides earlier one: %s [95]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -ghSw */
+
+int identifier;
+
+int
+example(int identifier)
+{
+
+	{
+		int identifier = 3;
+	}
+
+	return identifier;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_095.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_095.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_095.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_095.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_095.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1 @@
-msg_095.c(6): syntax error ':' [249]
+msg_095.c(15): warning: declaration hides earlier one: identifier [95]
Index: src/tests/usr.bin/xlint/lint1/msg_096.c
diff -u src/tests/usr.bin/xlint/lint1/msg_096.c:1.1 src/tests/usr.bin/xlint/lint1/msg_096.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_096.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_096.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,22 @@
-/*	$NetBSD: msg_096.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_096.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_096.c"
 
 // Test for message: cannot dereference non-pointer type [96]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+int
+unary_plus(int i)
+{
+	return +i;
+}
+
+int
+unary_minus(int i)
+{
+	return -i;
+}
+
+int
+unary_asterisk(int i)
+{
+	return *i;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_096.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_096.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_096.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_096.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_096.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1,3 @@
-msg_096.c(6): syntax error ':' [249]
+msg_096.c(21): cannot dereference non-pointer type [96]
+msg_096.c(21): warning: function unary_asterisk expects to return value [214]
+msg_096.c(19): warning: argument i unused in function unary_asterisk [231]
Index: src/tests/usr.bin/xlint/lint1/msg_097.c
diff -u src/tests/usr.bin/xlint/lint1/msg_097.c:1.1 src/tests/usr.bin/xlint/lint1/msg_097.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_097.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_097.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,21 @@
-/*	$NetBSD: msg_097.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_097.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_097.c"
 
-// Test for message: suffix U is illegal in traditional C [97]
+/* Test for message: suffix U is illegal in traditional C [97] */
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -gtw */
+
+void
+example()
+{
+	int i = 1234567;
+	unsigned u = 1234567;
+	unsigned u_upper = 1234567U;
+	unsigned u_lower = 1234567u;
+
+	long l = 1234567L;
+	unsigned long ul = 1234567UL;
+
+	long long ll = 1234567LL;
+	unsigned long long ull = 1234567ULL;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_097.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_097.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_097.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_097.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_097.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1,11 @@
-msg_097.c(6): syntax error ':' [249]
+(1): warning: 'long double' is illegal in traditional C [266]
+(1): warning: function prototypes are illegal in traditional C [270]
+(2): warning: 'long double' is illegal in traditional C [266]
+(2): warning: function prototypes are illegal in traditional C [270]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: function prototypes are illegal in traditional C [270]
+msg_097.c(13): warning: suffix U is illegal in traditional C [97]
+msg_097.c(14): warning: suffix U is illegal in traditional C [97]
+msg_097.c(17): warning: suffix U is illegal in traditional C [97]
+msg_097.c(20): warning: suffix U is illegal in traditional C [97]
Index: src/tests/usr.bin/xlint/lint1/msg_098.c
diff -u src/tests/usr.bin/xlint/lint1/msg_098.c:1.1 src/tests/usr.bin/xlint/lint1/msg_098.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_098.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_098.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,20 @@
-/*	$NetBSD: msg_098.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_098.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_098.c"
 
-// Test for message: suffixes F and L are illegal in traditional C [98]
+/* Test for message: suffixes F and L are illegal in traditional C [98] */
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -gtw */
+
+void
+example()
+{
+	float f = 1234.5;
+	float f_F = 1234.5F;
+	float f_f = 1234.5F;
+
+	double d = 1234.5;
+	double d_U = 1234.5U;
+
+	long double ld = 1234.5;
+	long double ld_L = 1234.5L;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_098.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_098.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_098.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_098.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_098.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1,13 @@
-msg_098.c(6): syntax error ':' [249]
+(1): warning: 'long double' is illegal in traditional C [266]
+(1): warning: function prototypes are illegal in traditional C [270]
+(2): warning: 'long double' is illegal in traditional C [266]
+(2): warning: function prototypes are illegal in traditional C [270]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: 'long double' is illegal in traditional C [266]
+(3): warning: function prototypes are illegal in traditional C [270]
+msg_098.c(12): warning: suffixes F and L are illegal in traditional C [98]
+msg_098.c(13): warning: suffixes F and L are illegal in traditional C [98]
+msg_098.c(16): syntax error 'U' [249]
+msg_098.c(18): warning: 'long double' is illegal in traditional C [266]
+msg_098.c(19): warning: 'long double' is illegal in traditional C [266]
+msg_098.c(19): warning: suffixes F and L are illegal in traditional C [98]
Index: src/tests/usr.bin/xlint/lint1/msg_099.c
diff -u src/tests/usr.bin/xlint/lint1/msg_099.c:1.1 src/tests/usr.bin/xlint/lint1/msg_099.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_099.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_099.c	Thu Jan  7 00:38:46 2021
@@ -1,7 +1,11 @@
-/*	$NetBSD: msg_099.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_099.c,v 1.2 2021/01/07 00:38:46 rillig Exp $	*/
 # 3 "msg_099.c"
 
 // Test for message: %s undefined [99]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+void
+example(int defined_variable)
+{
+	int ok = defined_variable;
+	int error = undefined_variable;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_099.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_099.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_099.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_099.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_099.exp	Thu Jan  7 00:38:46 2021
@@ -1 +1 @@
-msg_099.c(6): syntax error ':' [249]
+msg_099.c(10): undefined_variable undefined [99]

Reply via email to