Module Name:    src
Committed By:   rillig
Date:           Wed Jun 15 20:18:31 UTC 2022

Modified Files:
        src/tests/usr.bin/xlint: check-expect.lua
        src/tests/usr.bin/xlint/lint1: msg_000.c msg_000.exp msg_003.c
            msg_003.exp msg_004.c msg_004.exp msg_006.c msg_006.exp msg_008.c
            msg_008.exp msg_009.c msg_009.exp msg_019.c msg_019.exp msg_029.c
            msg_029.exp msg_031.c msg_031.exp msg_035.c msg_035.exp msg_036.c
            msg_036.exp msg_037.c msg_037.exp msg_050.c msg_050.exp msg_051.c
            msg_051.exp msg_055.c msg_056.c msg_056.exp msg_057.c msg_057.exp
            msg_060.c msg_060.exp msg_061.c msg_061.exp msg_068.c msg_068.exp
            msg_071.c msg_071.exp msg_073.c msg_073.exp msg_074.c msg_074.exp
            msg_075.c msg_075.exp msg_076.c msg_076.exp msg_077.c msg_077.exp
            msg_081.c msg_081.exp msg_082.c msg_082.exp msg_083.c msg_083.exp
            msg_085.c msg_085.exp msg_086.c msg_086.exp msg_087.c msg_087.exp
            msg_088.c msg_088.exp msg_089.c msg_089.exp msg_100.c msg_100.exp
            msg_105.c msg_105.exp msg_106.c msg_106.exp

Log Message:
tests/lint: replace 'expect' comments with 'expect+-' comments

The 'expect+-' comments provide more context, which makes it easier to
read the .c files on their own, without having to look up the actual
diagnostics in the .exp files.

Add tests for messages 105 and 106, which were about the obscure feature
of some traditional C compilers that allowed the expression 'x->member'
to access a struct member, even if 'x' had integer type.

The remaining tests will be migrated in a future commit.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/check-expect.lua
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_000.c \
    src/tests/usr.bin/xlint/lint1/msg_000.exp \
    src/tests/usr.bin/xlint/lint1/msg_006.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_029.c \
    src/tests/usr.bin/xlint/lint1/msg_036.c \
    src/tests/usr.bin/xlint/lint1/msg_036.exp \
    src/tests/usr.bin/xlint/lint1/msg_037.c \
    src/tests/usr.bin/xlint/lint1/msg_037.exp \
    src/tests/usr.bin/xlint/lint1/msg_050.c \
    src/tests/usr.bin/xlint/lint1/msg_055.c \
    src/tests/usr.bin/xlint/lint1/msg_056.c \
    src/tests/usr.bin/xlint/lint1/msg_057.exp \
    src/tests/usr.bin/xlint/lint1/msg_060.exp \
    src/tests/usr.bin/xlint/lint1/msg_061.c \
    src/tests/usr.bin/xlint/lint1/msg_061.exp \
    src/tests/usr.bin/xlint/lint1/msg_068.c \
    src/tests/usr.bin/xlint/lint1/msg_071.exp \
    src/tests/usr.bin/xlint/lint1/msg_073.c \
    src/tests/usr.bin/xlint/lint1/msg_073.exp \
    src/tests/usr.bin/xlint/lint1/msg_074.exp \
    src/tests/usr.bin/xlint/lint1/msg_075.c \
    src/tests/usr.bin/xlint/lint1/msg_076.c \
    src/tests/usr.bin/xlint/lint1/msg_076.exp \
    src/tests/usr.bin/xlint/lint1/msg_081.exp \
    src/tests/usr.bin/xlint/lint1/msg_082.exp \
    src/tests/usr.bin/xlint/lint1/msg_083.exp \
    src/tests/usr.bin/xlint/lint1/msg_085.c \
    src/tests/usr.bin/xlint/lint1/msg_086.c \
    src/tests/usr.bin/xlint/lint1/msg_087.c \
    src/tests/usr.bin/xlint/lint1/msg_088.c \
    src/tests/usr.bin/xlint/lint1/msg_089.c \
    src/tests/usr.bin/xlint/lint1/msg_089.exp \
    src/tests/usr.bin/xlint/lint1/msg_100.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_003.c \
    src/tests/usr.bin/xlint/lint1/msg_003.exp \
    src/tests/usr.bin/xlint/lint1/msg_004.exp \
    src/tests/usr.bin/xlint/lint1/msg_006.c \
    src/tests/usr.bin/xlint/lint1/msg_019.c \
    src/tests/usr.bin/xlint/lint1/msg_050.exp \
    src/tests/usr.bin/xlint/lint1/msg_051.c \
    src/tests/usr.bin/xlint/lint1/msg_051.exp \
    src/tests/usr.bin/xlint/lint1/msg_057.c \
    src/tests/usr.bin/xlint/lint1/msg_060.c \
    src/tests/usr.bin/xlint/lint1/msg_071.c \
    src/tests/usr.bin/xlint/lint1/msg_074.c \
    src/tests/usr.bin/xlint/lint1/msg_077.c \
    src/tests/usr.bin/xlint/lint1/msg_077.exp \
    src/tests/usr.bin/xlint/lint1/msg_081.c \
    src/tests/usr.bin/xlint/lint1/msg_082.c \
    src/tests/usr.bin/xlint/lint1/msg_083.c \
    src/tests/usr.bin/xlint/lint1/msg_085.exp \
    src/tests/usr.bin/xlint/lint1/msg_100.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_004.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_019.exp \
    src/tests/usr.bin/xlint/lint1/msg_031.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_029.exp \
    src/tests/usr.bin/xlint/lint1/msg_056.exp \
    src/tests/usr.bin/xlint/lint1/msg_068.exp \
    src/tests/usr.bin/xlint/lint1/msg_075.exp \
    src/tests/usr.bin/xlint/lint1/msg_086.exp \
    src/tests/usr.bin/xlint/lint1/msg_087.exp \
    src/tests/usr.bin/xlint/lint1/msg_088.exp \
    src/tests/usr.bin/xlint/lint1/msg_105.c \
    src/tests/usr.bin/xlint/lint1/msg_105.exp \
    src/tests/usr.bin/xlint/lint1/msg_106.c \
    src/tests/usr.bin/xlint/lint1/msg_106.exp
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_031.exp
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_035.c
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/msg_035.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/check-expect.lua
diff -u src/tests/usr.bin/xlint/check-expect.lua:1.14 src/tests/usr.bin/xlint/check-expect.lua:1.15
--- src/tests/usr.bin/xlint/check-expect.lua:1.14	Tue Dec  7 07:09:12 2021
+++ src/tests/usr.bin/xlint/check-expect.lua	Wed Jun 15 20:18:31 2022
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.14 2021/12/07 07:09:12 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.15 2022/06/15 20:18:31 rillig Exp $
 
 --[[
 
@@ -60,8 +60,13 @@ local function load_expect_comments_from
       add_expectation(tonumber(offset), comment)
     end
 
+    -- TODO: Remove these comments for all tests, as they often contain
+    -- only the raw message ID, without the actual message text,
+    -- which makes them harder to understand without looking up more context.
     for comment in line:gmatch("/%* expect: (.-) %*/") do
-      add_expectation(0, comment)
+      if not (fname:match("^msg_[0]")) then
+        add_expectation(0, comment)
+      end
     end
 
     pp_lineno = pp_lineno + 1

Index: src/tests/usr.bin/xlint/lint1/msg_000.c
diff -u src/tests/usr.bin/xlint/lint1/msg_000.c:1.3 src/tests/usr.bin/xlint/lint1/msg_000.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_000.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_000.c	Wed Jun 15 20:18:31 2022
@@ -1,10 +1,12 @@
-/*	$NetBSD: msg_000.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_000.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_000.c"
 
 // Test for message: empty declaration [0]
 
 extern int extern_declared;
 
-;				/* expect: 0 */
+/* expect+1: warning: empty declaration [0] */
+;
 
-static int local_defined;	/* expect: 226 */
+/* expect+1: warning: static variable 'local_defined' unused [226] */
+static int local_defined;
Index: src/tests/usr.bin/xlint/lint1/msg_000.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_000.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_000.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_000.exp:1.3	Sat Jun 11 11:52:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_000.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_000.c(8): warning: empty declaration [0]
-msg_000.c(10): warning: static variable 'local_defined' unused [226]
+msg_000.c(9): warning: empty declaration [0]
+msg_000.c(12): warning: static variable 'local_defined' unused [226]
Index: src/tests/usr.bin/xlint/lint1/msg_006.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_006.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_006.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_006.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_006.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_006.c(6): warning: use 'double' instead of 'long float' [6]
-msg_006.c(6): error: illegal type combination [4]
+msg_006.c(8): warning: use 'double' instead of 'long float' [6]
+msg_006.c(8): error: illegal type combination [4]
Index: src/tests/usr.bin/xlint/lint1/msg_008.c
diff -u src/tests/usr.bin/xlint/lint1/msg_008.c:1.3 src/tests/usr.bin/xlint/lint1/msg_008.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_008.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_008.c	Wed Jun 15 20:18:31 2022
@@ -1,9 +1,10 @@
-/*	$NetBSD: msg_008.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_008.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_008.c"
 
 // Test for message: illegal storage class [8]
 
 typedef void
 example(void)
-{				/* expect: 8 */
+/* expect+1: error: illegal storage class [8] */
+{
 }
Index: src/tests/usr.bin/xlint/lint1/msg_008.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_008.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_008.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_008.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_008.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_008.c(8): error: illegal storage class [8]
+msg_008.c(9): error: 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.3 src/tests/usr.bin/xlint/lint1/msg_009.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_009.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_009.c	Wed Jun 15 20:18:31 2022
@@ -1,9 +1,13 @@
-/*	$NetBSD: msg_009.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_009.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_009.c"
 
 // Test for message: only register valid as formal parameter storage class [9]
 
-extern void typedef_example(typedef int param);	/* expect: 9 */
-extern void auto_example(auto int param);	/* expect: 9 */
-extern void static_example(static int param);	/* expect: 9 */
-extern void extern_example(extern int param);	/* expect: 9 */
+/* expect+1: error: only register valid as formal parameter storage class [9] */
+extern void typedef_example(typedef int param);
+/* expect+1: error: only register valid as formal parameter storage class [9] */
+extern void auto_example(auto int param);
+/* expect+1: error: only register valid as formal parameter storage class [9] */
+extern void static_example(static int param);
+/* expect+1: error: only register valid as formal parameter storage class [9] */
+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.3 src/tests/usr.bin/xlint/lint1/msg_009.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_009.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_009.exp	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-msg_009.c(6): error: only register valid as formal parameter storage class [9]
 msg_009.c(7): error: only register valid as formal parameter storage class [9]
-msg_009.c(8): error: only register valid as formal parameter storage class [9]
 msg_009.c(9): error: only register valid as formal parameter storage class [9]
+msg_009.c(11): error: only register valid as formal parameter storage class [9]
+msg_009.c(13): error: only register valid as formal parameter storage class [9]
Index: src/tests/usr.bin/xlint/lint1/msg_029.c
diff -u src/tests/usr.bin/xlint/lint1/msg_029.c:1.3 src/tests/usr.bin/xlint/lint1/msg_029.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_029.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_029.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_029.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_029.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_029.c"
 
 // Test for message: previously declared extern, becomes static: %s [29]
@@ -6,6 +6,7 @@
 extern int function(void);
 
 static int function(void)
-{				/* expect: 29 */
+/* expect+1: warning: previously declared extern, becomes static: function [29] */
+{
 	return function();
 }
Index: src/tests/usr.bin/xlint/lint1/msg_036.c
diff -u src/tests/usr.bin/xlint/lint1/msg_036.c:1.3 src/tests/usr.bin/xlint/lint1/msg_036.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_036.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_036.c	Wed Jun 15 20:18:31 2022
@@ -1,10 +1,12 @@
-/*	$NetBSD: msg_036.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_036.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_036.c"
 
 // Test for message: illegal bit-field size: %d [36]
 
 struct example {
-	unsigned int too_large: 100000;	/* expect: 36 */
-	unsigned int negative: -1;	/* expect: 36 */
+	/* expect+1: error: illegal bit-field size: 160 [36] */
+	unsigned int too_large: 100000;
+	/* expect+1: error: illegal bit-field size: 255 [36] */
+	unsigned int negative: -1;
 	unsigned int ok: 3;
 };
Index: src/tests/usr.bin/xlint/lint1/msg_036.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_036.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_036.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_036.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_036.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_036.c(7): error: illegal bit-field size: 160 [36]
-msg_036.c(8): error: illegal bit-field size: 255 [36]
+msg_036.c(8): error: illegal bit-field size: 160 [36]
+msg_036.c(10): error: illegal bit-field size: 255 [36]
Index: src/tests/usr.bin/xlint/lint1/msg_037.c
diff -u src/tests/usr.bin/xlint/lint1/msg_037.c:1.3 src/tests/usr.bin/xlint/lint1/msg_037.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_037.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_037.c	Wed Jun 15 20:18:31 2022
@@ -1,9 +1,10 @@
-/*	$NetBSD: msg_037.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_037.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_037.c"
 
 // Test for message: zero size bit-field [37]
 
 struct example {
-	unsigned int zero: 0;	/* expect: 37 */
+	/* expect+1: error: zero size bit-field [37] */
+	unsigned int zero: 0;
 	unsigned int ok: 3;
 };
Index: src/tests/usr.bin/xlint/lint1/msg_037.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_037.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_037.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_037.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_037.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_037.c(7): error: zero size bit-field [37]
+msg_037.c(8): error: zero size bit-field [37]
Index: src/tests/usr.bin/xlint/lint1/msg_050.c
diff -u src/tests/usr.bin/xlint/lint1/msg_050.c:1.3 src/tests/usr.bin/xlint/lint1/msg_050.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_050.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_050.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_050.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_050.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_050.c"
 
 /* Test for message: a function is declared as an argument: %s [50] */
@@ -7,7 +7,9 @@
 
 typedef void (function)();
 
-void example(f)			/* expect: 231 */
-    function f;			/* expect: 50 */
+/* expect+1: warning: argument 'f' unused in function 'example' [231] */
+void example(f)
+    /* expect+1: warning: a function is declared as an argument: f [50] */
+    function f;
 {
 }
Index: src/tests/usr.bin/xlint/lint1/msg_055.c
diff -u src/tests/usr.bin/xlint/lint1/msg_055.c:1.3 src/tests/usr.bin/xlint/lint1/msg_055.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_055.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_055.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,9 @@
-/*	$NetBSD: msg_055.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_055.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_055.c"
 
 // Test for message: integral constant expression expected [55]
 
 enum color {
 	WHITE = 1.0
-};				/* expect: 55 */
+};
+/* expect-1: error: integral constant expression expected [55] */
Index: src/tests/usr.bin/xlint/lint1/msg_056.c
diff -u src/tests/usr.bin/xlint/lint1/msg_056.c:1.3 src/tests/usr.bin/xlint/lint1/msg_056.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_056.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_056.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,10 @@
-/*	$NetBSD: msg_056.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_056.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_056.c"
 
 // Test for message: integral constant too large [56]
 
 enum color {
-	WHITE = 0xFFFFFFFFFFFFFFFFFFFF	/* expect: 252 */
-};					/* expect: 56 */
+	/* expect+1: warning: integer constant out of range [252] */
+	WHITE = 0xFFFFFFFFFFFFFFFFFFFF
+};
+/* expect-1: warning: integral constant too large [56] */
Index: src/tests/usr.bin/xlint/lint1/msg_057.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_057.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_057.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_057.exp:1.3	Fri Apr  9 20:12:01 2021
+++ src/tests/usr.bin/xlint/lint1/msg_057.exp	Wed Jun 15 20:18:31 2022
@@ -1,6 +1,6 @@
-msg_057.c(10): warning: enumeration constant hides parameter: red [57]
-msg_057.c(10): warning: enumeration constant hides parameter: green [57]
-msg_057.c(11): warning: enumeration constant hides parameter: blue [57]
-msg_057.c(7): warning: argument 'red' unused in function 'rgb' [231]
-msg_057.c(7): warning: argument 'green' unused in function 'rgb' [231]
-msg_057.c(7): warning: argument 'blue' unused in function 'rgb' [231]
+msg_057.c(15): warning: enumeration constant hides parameter: red [57]
+msg_057.c(15): warning: enumeration constant hides parameter: green [57]
+msg_057.c(16): warning: enumeration constant hides parameter: blue [57]
+msg_057.c(10): warning: argument 'red' unused in function 'rgb' [231]
+msg_057.c(10): warning: argument 'green' unused in function 'rgb' [231]
+msg_057.c(10): warning: argument 'blue' unused in function 'rgb' [231]
Index: src/tests/usr.bin/xlint/lint1/msg_060.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_060.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_060.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_060.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_060.exp	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-msg_060.c(7): error: void must be sole parameter [60]
-msg_060.c(8): error: void must be sole parameter [60]
-msg_060.c(8): error: void must be sole parameter [60]
-msg_060.c(8): error: void must be sole parameter [60]
+msg_060.c(9): error: void must be sole parameter [60]
+msg_060.c(14): error: void must be sole parameter [60]
+msg_060.c(14): error: void must be sole parameter [60]
+msg_060.c(14): error: void must be sole parameter [60]
Index: src/tests/usr.bin/xlint/lint1/msg_061.c
diff -u src/tests/usr.bin/xlint/lint1/msg_061.c:1.3 src/tests/usr.bin/xlint/lint1/msg_061.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_061.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_061.c	Wed Jun 15 20:18:31 2022
@@ -1,6 +1,7 @@
-/*	$NetBSD: msg_061.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_061.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_061.c"
 
 // Test for message: void parameter cannot have name: %s [61]
 
-void example(void arg);		/* expect: 61 */
+/* expect+1: error: void parameter cannot have name: arg [61] */
+void example(void arg);
Index: src/tests/usr.bin/xlint/lint1/msg_061.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_061.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_061.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_061.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_061.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_061.c(6): error: void parameter cannot have name: arg [61]
+msg_061.c(7): error: void parameter cannot have name: arg [61]
Index: src/tests/usr.bin/xlint/lint1/msg_068.c
diff -u src/tests/usr.bin/xlint/lint1/msg_068.c:1.3 src/tests/usr.bin/xlint/lint1/msg_068.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_068.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_068.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,9 @@
-/*	$NetBSD: msg_068.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_068.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_068.c"
 
 // Test for message: typedef already qualified with '%s' [68]
 
 typedef const char const_char;
 
-const const_char twice_const;	/* expect: 68 */
+/* expect+1: warning: typedef already qualified with 'const' [68] */
+const const_char twice_const;
Index: src/tests/usr.bin/xlint/lint1/msg_071.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_071.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_071.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_071.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_071.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_071.c(11): error: too many characters in character constant [71]
-msg_071.c(11): warning: initializer does not fit [178]
+msg_071.c(13): error: too many characters in character constant [71]
+msg_071.c(13): warning: initializer does not fit [178]
Index: src/tests/usr.bin/xlint/lint1/msg_073.c
diff -u src/tests/usr.bin/xlint/lint1/msg_073.c:1.3 src/tests/usr.bin/xlint/lint1/msg_073.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_073.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_073.c	Wed Jun 15 20:18:31 2022
@@ -1,7 +1,8 @@
-/*	$NetBSD: msg_073.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_073.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_073.c"
 
 // Test for message: empty character constant [73]
 
-char empty = '';		/* expect: 73 */
+/* expect+1: error: empty character constant [73] */
+char empty = '';
 char letter = 'x';
Index: src/tests/usr.bin/xlint/lint1/msg_073.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_073.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_073.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_073.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_073.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_073.c(6): error: empty character constant [73]
+msg_073.c(7): error: empty character constant [73]
Index: src/tests/usr.bin/xlint/lint1/msg_074.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_074.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_074.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_074.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_074.exp	Wed Jun 15 20:18:31 2022
@@ -1,3 +1,3 @@
-msg_074.c(6): error: no hex digits follow \x [74]
 msg_074.c(7): error: no hex digits follow \x [74]
-msg_074.c(7): warning: multi-character character constant [294]
+msg_074.c(11): error: no hex digits follow \x [74]
+msg_074.c(11): warning: multi-character character constant [294]
Index: src/tests/usr.bin/xlint/lint1/msg_075.c
diff -u src/tests/usr.bin/xlint/lint1/msg_075.c:1.3 src/tests/usr.bin/xlint/lint1/msg_075.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_075.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_075.c	Wed Jun 15 20:18:31 2022
@@ -1,6 +1,7 @@
-/*	$NetBSD: msg_075.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_075.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_075.c"
 
 // Test for message: overflow in hex escape [75]
 
-char str[] = "\x12345678123456781234567812345678";	/* expect: 75 */
+/* expect+1: warning: overflow in hex escape [75] */
+char str[] = "\x12345678123456781234567812345678";
Index: src/tests/usr.bin/xlint/lint1/msg_076.c
diff -u src/tests/usr.bin/xlint/lint1/msg_076.c:1.3 src/tests/usr.bin/xlint/lint1/msg_076.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_076.c:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_076.c	Wed Jun 15 20:18:31 2022
@@ -1,6 +1,7 @@
-/*	$NetBSD: msg_076.c,v 1.3 2021/06/29 07:17:43 rillig Exp $	*/
+/*	$NetBSD: msg_076.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_076.c"
 
 // Test for message: character escape does not fit in character [76]
 
-char ch = '\777';		/* expect: [76] */
+/* expect+1: warning: character escape does not fit in character [76] */
+char ch = '\777';
Index: src/tests/usr.bin/xlint/lint1/msg_076.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_076.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_076.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_076.exp:1.3	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_076.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_076.c(6): warning: character escape does not fit in character [76]
+msg_076.c(7): warning: character escape does not fit in character [76]
Index: src/tests/usr.bin/xlint/lint1/msg_081.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_081.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_081.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_081.exp:1.3	Sun Mar 28 15:36:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_081.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_081.c(8): warning: \a undefined in traditional C [81]
+msg_081.c(9): warning: \a undefined in traditional C [81]
Index: src/tests/usr.bin/xlint/lint1/msg_082.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_082.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_082.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_082.exp:1.3	Sun Mar 28 15:36:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_082.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_082.c(8): warning: \x undefined in traditional C [82]
+msg_082.c(9): warning: \x undefined in traditional C [82]
Index: src/tests/usr.bin/xlint/lint1/msg_083.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_083.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_083.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_083.exp:1.3	Sat Jul 10 18:34:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_083.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_083.c(9): warning: storage class after type is obsolescent [83]
-msg_083.c(14): warning: storage class after type is obsolescent [83]
+msg_083.c(10): warning: storage class after type is obsolescent [83]
+msg_083.c(15): warning: storage class after type is obsolescent [83]
Index: src/tests/usr.bin/xlint/lint1/msg_085.c
diff -u src/tests/usr.bin/xlint/lint1/msg_085.c:1.3 src/tests/usr.bin/xlint/lint1/msg_085.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_085.c:1.3	Sun Jan 31 09:21:24 2021
+++ src/tests/usr.bin/xlint/lint1/msg_085.c	Wed Jun 15 20:18:31 2022
@@ -1,11 +1,15 @@
-/*	$NetBSD: msg_085.c,v 1.3 2021/01/31 09:21:24 rillig Exp $	*/
+/*	$NetBSD: msg_085.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_085.c"
 
 // Test for message: dubious tag declaration: %s %s [85]
 
-void declare_struct(struct in_argument *);	/* expect: 85 */
-void declare_union(union in_argument *);	/* expect: 85 */
-void declare_enum(enum in_argument *);		/* expect: 85 */
+/* expect+1: warning: dubious tag declaration: struct in_argument [85] */
+void declare_struct(struct in_argument *);
+/* expect+1: warning: dubious tag declaration: union in_argument [85] */
+void declare_union(union in_argument *);
+/* expect+1: warning: dubious tag declaration: enum in_argument [85] */
+void declare_enum(enum in_argument *);
 
-struct ok;					/* expect: 233 */
+/* expect+1: warning: struct 'ok' never defined [233] */
+struct ok;
 extern int ok(struct ok *);
Index: src/tests/usr.bin/xlint/lint1/msg_086.c
diff -u src/tests/usr.bin/xlint/lint1/msg_086.c:1.3 src/tests/usr.bin/xlint/lint1/msg_086.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_086.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_086.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_086.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_086.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_086.c"
 
 // Test for message: automatic hides external declaration: %s [86]
@@ -10,7 +10,8 @@ extern int identifier;
 int
 local_auto(void)
 {
-	int identifier = 3;	/* expect: 86 */
+	/* expect+1: warning: automatic hides external declaration: identifier [86] */
+	int identifier = 3;
 	return identifier;
 }
 
Index: src/tests/usr.bin/xlint/lint1/msg_087.c
diff -u src/tests/usr.bin/xlint/lint1/msg_087.c:1.3 src/tests/usr.bin/xlint/lint1/msg_087.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_087.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_087.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_087.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_087.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_087.c"
 
 // Test for message: static hides external declaration: %s [87]
@@ -10,6 +10,7 @@ extern int counter;
 int
 count(void)
 {
-	static int counter;		/* expect: 87 */
+	/* expect+1: warning: static hides external declaration: counter [87] */
+	static int counter;
 	return counter++;
 }
Index: src/tests/usr.bin/xlint/lint1/msg_088.c
diff -u src/tests/usr.bin/xlint/lint1/msg_088.c:1.3 src/tests/usr.bin/xlint/lint1/msg_088.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_088.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_088.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_088.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_088.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_088.c"
 
 // Test for message: typedef hides external declaration: %s [88]
@@ -10,5 +10,6 @@ extern int identifier;
 void
 func(void)
 {
-	typedef double identifier;	/* expect: 88 */
+	/* expect+1: warning: typedef hides external declaration: identifier [88] */
+	typedef double identifier;
 }
Index: src/tests/usr.bin/xlint/lint1/msg_089.c
diff -u src/tests/usr.bin/xlint/lint1/msg_089.c:1.3 src/tests/usr.bin/xlint/lint1/msg_089.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_089.c:1.3	Sun Jan 31 11:12:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_089.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,10 @@
-/*	$NetBSD: msg_089.c,v 1.3 2021/01/31 11:12:07 rillig Exp $	*/
+/*	$NetBSD: msg_089.c,v 1.4 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_089.c"
 
 // Test for message: typedef redeclared: %s [89]
 
 typedef int number;
-typedef int number;		/* expect: 89 */
-typedef double number;		/* expect: 89 */
+/* expect+1: error: typedef redeclared: number [89] */
+typedef int number;
+/* expect+1: error: typedef redeclared: number [89] */
+typedef double number;
Index: src/tests/usr.bin/xlint/lint1/msg_089.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_089.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_089.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_089.exp:1.3	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_089.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_089.c(7): error: typedef redeclared: number [89]
 msg_089.c(8): error: typedef redeclared: number [89]
+msg_089.c(10): error: typedef redeclared: number [89]
Index: src/tests/usr.bin/xlint/lint1/msg_100.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_100.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_100.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_100.exp:1.3	Sun Mar 28 15:36:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_100.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1 @@
-msg_100.c(10): warning: function prototypes are illegal in traditional C [270]
-msg_100.c(11): warning: unary + is illegal in traditional C [100]
+msg_100.c(13): warning: unary + is illegal in traditional C [100]

Index: src/tests/usr.bin/xlint/lint1/msg_003.c
diff -u src/tests/usr.bin/xlint/lint1/msg_003.c:1.4 src/tests/usr.bin/xlint/lint1/msg_003.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_003.c:1.4	Sun Feb 28 12:40:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_003.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_003.c,v 1.4 2021/02/28 12:40:00 rillig Exp $	*/
+/*	$NetBSD: msg_003.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_003.c"
 
 // Test for message: '%s' declared in argument declaration list [3]
@@ -6,8 +6,11 @@
 /*ARGSUSED*/
 void
 example(declare_struct, declare_union, declare_enum)
-    struct struct_in_argument *declare_struct;	/* expect: 3 */
-    union union_in_argument *declare_union;	/* expect: 3 */
-    enum enum_in_argument *declare_enum;	/* expect: 3 */
+    /* expect+1: warning: 'incomplete struct struct_in_argument' declared in argument declaration list [3] */
+    struct struct_in_argument *declare_struct;
+    /* expect+1: warning: 'incomplete union union_in_argument' declared in argument declaration list [3] */
+    union union_in_argument *declare_union;
+    /* expect+1: warning: 'enum enum_in_argument' declared in argument declaration list [3] */
+    enum enum_in_argument *declare_enum;
 {
 }
Index: src/tests/usr.bin/xlint/lint1/msg_003.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_003.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_003.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_003.exp:1.4	Fri Apr  9 19:37:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_003.exp	Wed Jun 15 20:18:31 2022
@@ -1,3 +1,3 @@
-msg_003.c(9): warning: 'incomplete struct struct_in_argument' declared in argument declaration list [3]
-msg_003.c(10): warning: 'incomplete union union_in_argument' declared in argument declaration list [3]
-msg_003.c(11): warning: 'enum enum_in_argument' declared in argument declaration list [3]
+msg_003.c(10): warning: 'incomplete struct struct_in_argument' declared in argument declaration list [3]
+msg_003.c(12): warning: 'incomplete union union_in_argument' declared in argument declaration list [3]
+msg_003.c(14): warning: 'enum enum_in_argument' declared in argument declaration list [3]
Index: src/tests/usr.bin/xlint/lint1/msg_004.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_004.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_004.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_004.exp:1.4	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_004.exp	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-msg_004.c(13): error: invalid type for _Complex [308]
-msg_004.c(13): error: illegal type combination [4]
-msg_004.c(17): error: illegal type combination [4]
-msg_004.c(21): error: illegal type combination [4]
+msg_004.c(15): error: invalid type for _Complex [308]
+msg_004.c(15): error: illegal type combination [4]
+msg_004.c(19): error: illegal type combination [4]
+msg_004.c(24): error: illegal type combination [4]
Index: src/tests/usr.bin/xlint/lint1/msg_006.c
diff -u src/tests/usr.bin/xlint/lint1/msg_006.c:1.4 src/tests/usr.bin/xlint/lint1/msg_006.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_006.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_006.c	Wed Jun 15 20:18:31 2022
@@ -1,7 +1,9 @@
-/*	$NetBSD: msg_006.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_006.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_006.c"
 
 // Test for message: use 'double' instead of 'long float' [6]
 
-long float x;			/* expect: 6 *//* expect: 4 */
+/* expect+2: warning: use 'double' instead of 'long float' [6] */
+/* expect+1: error: illegal type combination [4] */
+long float x;
 double x;
Index: src/tests/usr.bin/xlint/lint1/msg_019.c
diff -u src/tests/usr.bin/xlint/lint1/msg_019.c:1.4 src/tests/usr.bin/xlint/lint1/msg_019.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_019.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_019.c	Wed Jun 15 20:18:31 2022
@@ -1,14 +1,20 @@
-/*	$NetBSD: msg_019.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_019.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_019.c"
 
 // Test for message: void type for '%s' [19]
 
-void global_variable;		/* expect: 19 */
+/* expect+1: error: void type for 'global_variable' [19] */
+void global_variable;
 
-static void unit_variable;	/* expect: 19 *//* expect: 226 */
+/* expect+2: error: void type for 'unit_variable' [19] */
+/* expect+1: warning: static variable 'unit_variable' unused [226] */
+static void unit_variable;
 
+/* expect+3: warning: argument 'parameter' unused in function 'function' [231] */
+/* expect+2: error: void parameter cannot have name: parameter [61] */
 void
-function(void parameter)	/* expect: 61 *//* expect: 231 */
+function(void parameter)
 {
-	void local_variable;	/* expect: 19 */
+	/* expect+1: error: void type for 'local_variable' [19] */
+	void local_variable;
 }
Index: src/tests/usr.bin/xlint/lint1/msg_050.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_050.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_050.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_050.exp:1.4	Fri Apr  9 20:12:01 2021
+++ src/tests/usr.bin/xlint/lint1/msg_050.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_050.c(11): warning: a function is declared as an argument: f [50]
-msg_050.c(10): warning: argument 'f' unused in function 'example' [231]
+msg_050.c(13): warning: a function is declared as an argument: f [50]
+msg_050.c(11): warning: argument 'f' unused in function 'example' [231]
Index: src/tests/usr.bin/xlint/lint1/msg_051.c
diff -u src/tests/usr.bin/xlint/lint1/msg_051.c:1.4 src/tests/usr.bin/xlint/lint1/msg_051.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_051.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_051.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_051.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_051.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_051.c"
 
 // Test for message: parameter mismatch: %d declared, %d defined [51]
@@ -7,7 +7,11 @@ void
 example(int, int);
 
 void
-example(a, b, c)		/* expect: 231 *//* expect: 231 *//* expect: 231 */
+/* expect+3: warning: argument 'a' unused in function 'example' [231] */
+/* expect+2: warning: argument 'b' unused in function 'example' [231] */
+/* expect+1: warning: argument 'c' unused in function 'example' [231] */
+example(a, b, c)
     int a, b, c;
-{				/* expect: 51 */
+/* expect+1: error: parameter mismatch: 2 declared, 3 defined [51] */
+{
 }
Index: src/tests/usr.bin/xlint/lint1/msg_051.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_051.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_051.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_051.exp:1.4	Fri Apr  9 20:12:01 2021
+++ src/tests/usr.bin/xlint/lint1/msg_051.exp	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-msg_051.c(12): error: parameter mismatch: 2 declared, 3 defined [51]
-msg_051.c(10): warning: argument 'a' unused in function 'example' [231]
-msg_051.c(10): warning: argument 'b' unused in function 'example' [231]
-msg_051.c(10): warning: argument 'c' unused in function 'example' [231]
+msg_051.c(16): error: parameter mismatch: 2 declared, 3 defined [51]
+msg_051.c(13): warning: argument 'a' unused in function 'example' [231]
+msg_051.c(13): warning: argument 'b' unused in function 'example' [231]
+msg_051.c(13): warning: argument 'c' unused in function 'example' [231]
Index: src/tests/usr.bin/xlint/lint1/msg_057.c
diff -u src/tests/usr.bin/xlint/lint1/msg_057.c:1.4 src/tests/usr.bin/xlint/lint1/msg_057.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_057.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_057.c	Wed Jun 15 20:18:31 2022
@@ -1,14 +1,26 @@
-/*	$NetBSD: msg_057.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_057.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_057.c"
 
 // Test for message: enumeration constant hides parameter: %s [57]
 
 long
-rgb(int red, int green, int blue)	/* expect: 231 *//* expect: 231 *//* expect: 231 */
+/* expect+3: warning: argument 'red' unused in function 'rgb' [231] */
+/* expect+2: warning: argument 'green' unused in function 'rgb' [231] */
+/* expect+1: warning: argument 'blue' unused in function 'rgb' [231] */
+rgb(int red, int green, int blue)
 {
 	enum color {
-		red, green, blue	/* expect: 57 *//* expect: 57 */
-	};				/* expect: 57 */
+		/* expect+2: warning: enumeration constant hides parameter: red [57] */
+		/* expect+1: warning: enumeration constant hides parameter: green [57] */
+		red, green, blue
+	};
+	/* expect-1: warning: enumeration constant hides parameter: blue [57] */
+	/*
+	 * The warning for 'blue' is at the semicolon since the parser has
+	 * already advanced that far, checking for an optional initializer.
+	 * As of 2022-06-15, lint does not keep track of the location of each
+	 * individual token.
+	 */
 
 	return red + green + blue;
 }
Index: src/tests/usr.bin/xlint/lint1/msg_060.c
diff -u src/tests/usr.bin/xlint/lint1/msg_060.c:1.4 src/tests/usr.bin/xlint/lint1/msg_060.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_060.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_060.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,14 @@
-/*	$NetBSD: msg_060.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_060.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_060.c"
 
 // Test for message: void must be sole parameter [60]
 
 void example_1(void);
-void example_2(int, void);		/* expect: 60 */
-void example_3(void, void, void);	/* expect: 60 *//* expect: 60 *//* expect: 60 */
+
+/* expect+1: error: void must be sole parameter [60] */
+void example_2(int, void);
+
+/* expect+3: error: void must be sole parameter [60] */
+/* expect+2: error: void must be sole parameter [60] */
+/* expect+1: error: void must be sole parameter [60] */
+void example_3(void, void, void);
Index: src/tests/usr.bin/xlint/lint1/msg_071.c
diff -u src/tests/usr.bin/xlint/lint1/msg_071.c:1.4 src/tests/usr.bin/xlint/lint1/msg_071.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_071.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_071.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_071.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_071.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_071.c"
 
 // Test for message: too many characters in character constant [71]
@@ -8,4 +8,6 @@
  * sequence of characters that can constitute the escape sequence.
  */
 char valid_multi_digit_hex = '\x0000000000000000000000a';
-char invalid_multi_digit_hex = '\x000g000000000000000000a'; /* expect: 71 *//* expect: 178 */
+/* expect+2: error: too many characters in character constant [71] */
+/* expect+1: warning: initializer does not fit [178] */
+char invalid_multi_digit_hex = '\x000g000000000000000000a';
Index: src/tests/usr.bin/xlint/lint1/msg_074.c
diff -u src/tests/usr.bin/xlint/lint1/msg_074.c:1.4 src/tests/usr.bin/xlint/lint1/msg_074.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_074.c:1.4	Mon Apr  5 01:35:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_074.c	Wed Jun 15 20:18:31 2022
@@ -1,9 +1,14 @@
-/*	$NetBSD: msg_074.c,v 1.4 2021/04/05 01:35:34 rillig Exp $	*/
+/*	$NetBSD: msg_074.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_074.c"
 
 // Test for message: no hex digits follow \x [74]
 
-char invalid_hex = '\x';		/* expect: 74 */
-char invalid_hex_letter = '\xg';	/* expect: 74 *//* expect: 294 */
+/* expect+1: error: no hex digits follow \x [74] */
+char invalid_hex = '\x';
+
+/* expect+2: error: no hex digits follow \x [74] */
+/* expect+1: warning: multi-character character constant [294] */
+char invalid_hex_letter = '\xg';
+
 char valid_hex = '\xff';
 char valid_single_digit_hex = '\xa';
Index: src/tests/usr.bin/xlint/lint1/msg_077.c
diff -u src/tests/usr.bin/xlint/lint1/msg_077.c:1.4 src/tests/usr.bin/xlint/lint1/msg_077.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_077.c:1.4	Tue Jun 29 07:23:21 2021
+++ src/tests/usr.bin/xlint/lint1/msg_077.c	Wed Jun 15 20:18:31 2022
@@ -1,11 +1,12 @@
-/*	$NetBSD: msg_077.c,v 1.4 2021/06/29 07:23:21 rillig Exp $	*/
+/*	$NetBSD: msg_077.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_077.c"
 
 /* Test for message: bad octal digit %c [77] */
 
 /* lint1-flags: -tw */
 
-char single_digit = '\8';	/* expect: bad octal digit 8 [77] */
+/* expect+1: warning: bad octal digit 8 [77] */
+char single_digit = '\8';
 
 /*
  * Before lex.c 1.47 from 2021-06-29, lint intended to detect a "bad octal
Index: src/tests/usr.bin/xlint/lint1/msg_077.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_077.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_077.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_077.exp:1.4	Tue Jun 29 07:23:21 2021
+++ src/tests/usr.bin/xlint/lint1/msg_077.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_077.c(8): warning: bad octal digit 8 [77]
-msg_077.c(26): warning: multi-character character constant [294]
+msg_077.c(9): warning: bad octal digit 8 [77]
+msg_077.c(27): warning: multi-character character constant [294]
Index: src/tests/usr.bin/xlint/lint1/msg_081.c
diff -u src/tests/usr.bin/xlint/lint1/msg_081.c:1.4 src/tests/usr.bin/xlint/lint1/msg_081.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_081.c:1.4	Sat Apr 16 13:25:27 2022
+++ src/tests/usr.bin/xlint/lint1/msg_081.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,9 @@
-/*	$NetBSD: msg_081.c,v 1.4 2022/04/16 13:25:27 rillig Exp $	*/
+/*	$NetBSD: msg_081.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_081.c"
 
 /* Test for message: \a undefined in traditional C [81] */
 
 /* lint1-flags: -tw */
 
-char str[] = "The bell\a rings";	/* expect: 81 */
+/* expect+1: warning: \a undefined in traditional C [81] */
+char str[] = "The bell\a rings";
Index: src/tests/usr.bin/xlint/lint1/msg_082.c
diff -u src/tests/usr.bin/xlint/lint1/msg_082.c:1.4 src/tests/usr.bin/xlint/lint1/msg_082.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_082.c:1.4	Tue Jun 29 07:17:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_082.c	Wed Jun 15 20:18:31 2022
@@ -1,8 +1,9 @@
-/*	$NetBSD: msg_082.c,v 1.4 2021/06/29 07:17:43 rillig Exp $	*/
+/*	$NetBSD: msg_082.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_082.c"
 
 /* Test for message: \x undefined in traditional C [82] */
 
 /* lint1-flags: -Stw */
 
-char str[] = "A he\x78 escape";		/* expect: [82] */
+/* expect+1: warning: \x undefined in traditional C [82] */
+char str[] = "A he\x78 escape";
Index: src/tests/usr.bin/xlint/lint1/msg_083.c
diff -u src/tests/usr.bin/xlint/lint1/msg_083.c:1.4 src/tests/usr.bin/xlint/lint1/msg_083.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_083.c:1.4	Sat Jul 10 18:34:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_083.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_083.c,v 1.4 2021/07/10 18:34:03 rillig Exp $	*/
+/*	$NetBSD: msg_083.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_083.c"
 
 // Test for message: storage class after type is obsolescent [83]
@@ -6,7 +6,8 @@
 void
 example(void)
 {
-	int register x;		/* expect: 83 */
+	/* expect+1: warning: storage class after type is obsolescent [83] */
+	int register x;
 }
 
 struct {
Index: src/tests/usr.bin/xlint/lint1/msg_085.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_085.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_085.exp:1.5
--- src/tests/usr.bin/xlint/lint1/msg_085.exp:1.4	Sat Jun 11 11:52:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_085.exp	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-msg_085.c(6): warning: dubious tag declaration: struct in_argument [85]
-msg_085.c(7): warning: dubious tag declaration: union in_argument [85]
-msg_085.c(8): warning: dubious tag declaration: enum in_argument [85]
-msg_085.c(10): warning: struct 'ok' never defined [233]
+msg_085.c(7): warning: dubious tag declaration: struct in_argument [85]
+msg_085.c(9): warning: dubious tag declaration: union in_argument [85]
+msg_085.c(11): warning: dubious tag declaration: enum in_argument [85]
+msg_085.c(14): warning: struct 'ok' never defined [233]
Index: src/tests/usr.bin/xlint/lint1/msg_100.c
diff -u src/tests/usr.bin/xlint/lint1/msg_100.c:1.4 src/tests/usr.bin/xlint/lint1/msg_100.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_100.c:1.4	Sat Apr 16 13:25:27 2022
+++ src/tests/usr.bin/xlint/lint1/msg_100.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_100.c,v 1.4 2022/04/16 13:25:27 rillig Exp $	*/
+/*	$NetBSD: msg_100.c,v 1.5 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_100.c"
 
 /* Test for message: unary + is illegal in traditional C [100] */
@@ -6,7 +6,9 @@
 /* lint1-flags: -tw */
 
 int
-unary_plus(int x)
-{				/* expect: 270 */
-	return +x;		/* expect: 100 */
+unary_plus(x)
+	int x;
+{
+	/* expect+1: warning: unary + is illegal in traditional C [100] */
+	return +x;
 }

Index: src/tests/usr.bin/xlint/lint1/msg_004.c
diff -u src/tests/usr.bin/xlint/lint1/msg_004.c:1.5 src/tests/usr.bin/xlint/lint1/msg_004.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_004.c:1.5	Sun Jul  4 13:32:35 2021
+++ src/tests/usr.bin/xlint/lint1/msg_004.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_004.c,v 1.5 2021/07/04 13:32:35 rillig Exp $	*/
+/*	$NetBSD: msg_004.c,v 1.6 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_004.c"
 
 // Test for message: illegal type combination [4]
@@ -10,12 +10,16 @@ int ok_int;
 double ok_double;
 float _Complex ok_float_complex;
 
-int _Complex illegal_int_complex;	/* expect: 4 *//* expect: 308 */
+/* expect+2: error: invalid type for _Complex [308] */
+/* expect+1: error: illegal type combination [4] */
+int _Complex illegal_int_complex;
 
 char enum {
 	CHAR
-};					/* expect: 4 */
+};
+/* expect-1: error: illegal type combination [4] */
 
 long struct {
 	int member;
-};					/* expect: 4 */
+};
+/* expect-1: error: illegal type combination [4] */

Index: src/tests/usr.bin/xlint/lint1/msg_019.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_019.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_019.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_019.exp:1.6	Sat Jun 11 11:52:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_019.exp	Wed Jun 15 20:18:31 2022
@@ -1,6 +1,6 @@
-msg_019.c(6): error: void type for 'global_variable' [19]
-msg_019.c(8): error: void type for 'unit_variable' [19]
-msg_019.c(11): error: void parameter cannot have name: parameter [61]
-msg_019.c(13): error: void type for 'local_variable' [19]
-msg_019.c(11): warning: argument 'parameter' unused in function 'function' [231]
-msg_019.c(8): warning: static variable 'unit_variable' unused [226]
+msg_019.c(7): error: void type for 'global_variable' [19]
+msg_019.c(11): error: void type for 'unit_variable' [19]
+msg_019.c(16): error: void parameter cannot have name: parameter [61]
+msg_019.c(19): error: void type for 'local_variable' [19]
+msg_019.c(16): warning: argument 'parameter' unused in function 'function' [231]
+msg_019.c(11): warning: static variable 'unit_variable' unused [226]
Index: src/tests/usr.bin/xlint/lint1/msg_031.c
diff -u src/tests/usr.bin/xlint/lint1/msg_031.c:1.6 src/tests/usr.bin/xlint/lint1/msg_031.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_031.c:1.6	Tue Jul 13 22:01:34 2021
+++ src/tests/usr.bin/xlint/lint1/msg_031.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_031.c,v 1.6 2021/07/13 22:01:34 rillig Exp $	*/
+/*	$NetBSD: msg_031.c,v 1.7 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_031.c"
 
 // Test for message: '%s' has incomplete type '%s' [31]
@@ -7,7 +7,8 @@ struct complete {
 	int dummy;
 };
 
-struct incomplete;			/* expect: 233 */
+/* expect+1: warning: struct 'incomplete' never defined [233] */
+struct incomplete;
 
 
 struct complete complete_var;

Index: src/tests/usr.bin/xlint/lint1/msg_029.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_029.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_029.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_029.exp:1.2	Sun Jan  3 15:35:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_029.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_029.c(9): warning: previously declared extern, becomes static: function [29]
+msg_029.c(10): warning: previously declared extern, becomes static: function [29]
Index: src/tests/usr.bin/xlint/lint1/msg_056.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_056.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_056.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_056.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_056.exp	Wed Jun 15 20:18:31 2022
@@ -1,2 +1,2 @@
-msg_056.c(7): warning: integer constant out of range [252]
-msg_056.c(8): warning: integral constant too large [56]
+msg_056.c(8): warning: integer constant out of range [252]
+msg_056.c(9): warning: integral constant too large [56]
Index: src/tests/usr.bin/xlint/lint1/msg_068.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_068.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_068.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_068.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_068.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_068.c(8): warning: typedef already qualified with 'const' [68]
+msg_068.c(9): warning: typedef already qualified with 'const' [68]
Index: src/tests/usr.bin/xlint/lint1/msg_075.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_075.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_075.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_075.exp:1.2	Fri Jan  8 21:25:03 2021
+++ src/tests/usr.bin/xlint/lint1/msg_075.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_075.c(6): warning: overflow in hex escape [75]
+msg_075.c(7): warning: overflow in hex escape [75]
Index: src/tests/usr.bin/xlint/lint1/msg_086.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_086.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_086.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_086.exp:1.2	Sun Jan  3 15:35:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_086.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_086.c(13): warning: automatic hides external declaration: identifier [86]
+msg_086.c(14): warning: automatic hides external declaration: identifier [86]
Index: src/tests/usr.bin/xlint/lint1/msg_087.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_087.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_087.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_087.exp:1.2	Sun Jan  3 15:35:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_087.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_087.c(13): warning: static hides external declaration: counter [87]
+msg_087.c(14): warning: static hides external declaration: counter [87]
Index: src/tests/usr.bin/xlint/lint1/msg_088.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_088.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_088.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_088.exp:1.2	Sun Jan  3 15:35:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_088.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_088.c(13): warning: typedef hides external declaration: identifier [88]
+msg_088.c(14): warning: typedef hides external declaration: identifier [88]
Index: src/tests/usr.bin/xlint/lint1/msg_105.c
diff -u src/tests/usr.bin/xlint/lint1/msg_105.c:1.2 src/tests/usr.bin/xlint/lint1/msg_105.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_105.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_105.c	Wed Jun 15 20:18:31 2022
@@ -1,7 +1,46 @@
-/*	$NetBSD: msg_105.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_105.c,v 1.3 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_105.c"
 
-// Test for message: non-unique member requires struct/union %s [105]
+/* Test for message: non-unique member requires struct/union %s [105] */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -tw */
+
+/*
+ * In traditional C, the expression 'x->y' did not only allow struct or union
+ * pointers for 'x', but in fact any scalar expression, which would then be
+ * dereferenced as if it were a struct or union.
+ *
+ * This led to ambiguities if several structs had a member of the same name
+ * but with different offsets.  In such a case, that member name could only
+ * be used with one of its actual struct types.
+ */
+
+struct one {
+	int member;
+};
+
+struct two {
+	int before_member;	/* make the offset of 'member' different */
+	int member;
+};
+
+struct three {
+	int x;
+	int y;
+};
+
+int
+example(x)
+	int *x;
+{
+	/* expect+1: error: non-unique member requires struct/union pointer [105] */
+	return x->member;
+}
+
+int
+member_of_wrong_struct(t)
+	struct three *t;
+{
+	/* expect+1: error: illegal member use: member [102] */
+	return t->member;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_105.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_105.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_105.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_105.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_105.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1,2 @@
-msg_105.c(6): error: syntax error ':' [249]
+msg_105.c(37): error: non-unique member requires struct/union pointer [105]
+msg_105.c(45): error: illegal member use: member [102]
Index: src/tests/usr.bin/xlint/lint1/msg_106.c
diff -u src/tests/usr.bin/xlint/lint1/msg_106.c:1.2 src/tests/usr.bin/xlint/lint1/msg_106.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_106.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_106.c	Wed Jun 15 20:18:31 2022
@@ -1,7 +1,17 @@
-/*	$NetBSD: msg_106.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_106.c,v 1.3 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_106.c"
 
 // Test for message: left operand of '->' must be pointer [106]
+// This message is not used.
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct s {
+	int member;
+};
+
+void example(struct s s)
+{
+	s.member++;
+
+	/* expect+1: error: left operand of '->' must be pointer to struct or union, not 'struct s' [104] */
+	return s->member;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_106.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_106.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_106.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_106.exp:1.2	Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_106.exp	Wed Jun 15 20:18:31 2022
@@ -1 +1 @@
-msg_106.c(6): error: syntax error ':' [249]
+msg_106.c(16): error: left operand of '->' must be pointer to struct or union, not 'struct s' [104]

Index: src/tests/usr.bin/xlint/lint1/msg_031.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_031.exp:1.7 src/tests/usr.bin/xlint/lint1/msg_031.exp:1.8
--- src/tests/usr.bin/xlint/lint1/msg_031.exp:1.7	Sat Jun 11 11:52:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_031.exp	Wed Jun 15 20:18:31 2022
@@ -1,3 +1,3 @@
-msg_031.c(20): error: '<unnamed>' has incomplete type 'incomplete struct incomplete' [31]
-msg_031.c(10): warning: struct 'incomplete' never defined [233]
-msg_031.c(16): error: 'incomplete_var' has incomplete type 'incomplete struct incomplete' [31]
+msg_031.c(21): error: '<unnamed>' has incomplete type 'incomplete struct incomplete' [31]
+msg_031.c(11): warning: struct 'incomplete' never defined [233]
+msg_031.c(17): error: 'incomplete_var' has incomplete type 'incomplete struct incomplete' [31]

Index: src/tests/usr.bin/xlint/lint1/msg_035.c
diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.10 src/tests/usr.bin/xlint/lint1/msg_035.c:1.11
--- src/tests/usr.bin/xlint/lint1/msg_035.c:1.10	Wed Dec 22 14:25:35 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.c	Wed Jun 15 20:18:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_035.c,v 1.10 2021/12/22 14:25:35 rillig Exp $	*/
+/*	$NetBSD: msg_035.c,v 1.11 2022/06/15 20:18:31 rillig Exp $	*/
 # 3 "msg_035.c"
 
 // Test for message: illegal bit-field type '%s' [35]
@@ -41,24 +41,48 @@ struct example {
 	unsigned short unsigned_short_flag: 1;
 	int int_flag: 1;
 	unsigned int unsigned_int_flag: 1;
-	long long_flag: 1;				/* expect: 35 */
-	unsigned long unsigned_long_flag: 1;		/* expect: 35 */
-	long long long_long_flag: 1;			/* expect: 35 */
-	unsigned long long unsigned_long_long_flag: 1;	/* expect: 35 */
+
+	/* expect+1: warning: illegal bit-field type 'long' [35] */
+	long long_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'unsigned long' [35] */
+	unsigned long unsigned_long_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'long long' [35] */
+	long long long_long_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'unsigned long long' [35] */
+	unsigned long long unsigned_long_long_flag: 1;
+
 	/* __int128_t omitted since it is not always defined */
 	/* __uint128_t omitted since it is not always defined */
-	float float_flag: 1;				/* expect: 35 */
-	double double_flag: 1;				/* expect: 35 */
-	long double long_double_flag: 1;		/* expect: 35 */
-	void void_flag: 1;				/* expect: 19 *//* expect: 37 */
-	example_struct struct_flag: 1;			/* expect: 35 */
-	example_union union_flag: 1;			/* expect: 35 */
+
+	/* expect+1: warning: illegal bit-field type 'float' [35] */
+	float float_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'double' [35] */
+	double double_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'long double' [35] */
+	long double long_double_flag: 1;
+	/* expect+2: error: void type for 'void_flag' [19] */
+	/* expect+1: error: zero size bit-field [37] */
+	void void_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'struct typedef example_struct' [35] */
+	example_struct struct_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'union typedef example_union' [35] */
+	example_union union_flag: 1;
+
 	example_enum enum_flag: 1;
-	void *pointer_flag: 1;				/* expect: 35 */
-	unsigned int array_flag[4]: 1;			/* expect: 35 */
-	example_function function_flag: 1;		/* expect: 35 */
-	_Complex complex_flag: 1;			/* expect: 35 *//* expect: 308 */
-	float _Complex float_complex_flag: 1;		/* expect: 35 */
-	double _Complex double_complex_flag: 1;		/* expect: 35 */
-	long double _Complex long_double_complex_flag: 1; /* expect: 35 */
+
+	/* expect+1: warning: illegal bit-field type 'pointer to void' [35] */
+	void *pointer_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'array[4] of unsigned int' [35] */
+	unsigned int array_flag[4]: 1;
+	/* expect+1: warning: illegal bit-field type 'function(int, pointer to const char) returning void' [35] */
+	example_function function_flag: 1;
+	/* expect+2: error: invalid type for _Complex [308] */
+	/* expect+1: warning: illegal bit-field type 'double _Complex' [35] */
+	_Complex complex_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'float _Complex' [35] */
+	float _Complex float_complex_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'double _Complex' [35] */
+	double _Complex double_complex_flag: 1;
+	/* expect+1: warning: illegal bit-field type 'long double _Complex' [35] */
+	long double _Complex long_double_complex_flag: 1;
 };

Index: src/tests/usr.bin/xlint/lint1/msg_035.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.11 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.12
--- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.11	Sun May  2 21:22:09 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.exp	Wed Jun 15 20:18:31 2022
@@ -1,19 +1,19 @@
-msg_035.c(44): warning: illegal bit-field type 'long' [35]
-msg_035.c(45): warning: illegal bit-field type 'unsigned long' [35]
-msg_035.c(46): warning: illegal bit-field type 'long long' [35]
-msg_035.c(47): warning: illegal bit-field type 'unsigned long long' [35]
-msg_035.c(50): warning: illegal bit-field type 'float' [35]
-msg_035.c(51): warning: illegal bit-field type 'double' [35]
-msg_035.c(52): warning: illegal bit-field type 'long double' [35]
-msg_035.c(53): error: void type for 'void_flag' [19]
-msg_035.c(53): error: zero size bit-field [37]
-msg_035.c(54): warning: illegal bit-field type 'struct typedef example_struct' [35]
-msg_035.c(55): warning: illegal bit-field type 'union typedef example_union' [35]
-msg_035.c(57): warning: illegal bit-field type 'pointer to void' [35]
-msg_035.c(58): warning: illegal bit-field type 'array[4] of unsigned int' [35]
-msg_035.c(59): warning: illegal bit-field type 'function(int, pointer to const char) returning void' [35]
-msg_035.c(60): error: invalid type for _Complex [308]
-msg_035.c(60): warning: illegal bit-field type 'double _Complex' [35]
-msg_035.c(61): warning: illegal bit-field type 'float _Complex' [35]
-msg_035.c(62): warning: illegal bit-field type 'double _Complex' [35]
-msg_035.c(63): warning: illegal bit-field type 'long double _Complex' [35]
+msg_035.c(46): warning: illegal bit-field type 'long' [35]
+msg_035.c(48): warning: illegal bit-field type 'unsigned long' [35]
+msg_035.c(50): warning: illegal bit-field type 'long long' [35]
+msg_035.c(52): warning: illegal bit-field type 'unsigned long long' [35]
+msg_035.c(58): warning: illegal bit-field type 'float' [35]
+msg_035.c(60): warning: illegal bit-field type 'double' [35]
+msg_035.c(62): warning: illegal bit-field type 'long double' [35]
+msg_035.c(65): error: void type for 'void_flag' [19]
+msg_035.c(65): error: zero size bit-field [37]
+msg_035.c(67): warning: illegal bit-field type 'struct typedef example_struct' [35]
+msg_035.c(69): warning: illegal bit-field type 'union typedef example_union' [35]
+msg_035.c(74): warning: illegal bit-field type 'pointer to void' [35]
+msg_035.c(76): warning: illegal bit-field type 'array[4] of unsigned int' [35]
+msg_035.c(78): warning: illegal bit-field type 'function(int, pointer to const char) returning void' [35]
+msg_035.c(81): error: invalid type for _Complex [308]
+msg_035.c(81): warning: illegal bit-field type 'double _Complex' [35]
+msg_035.c(83): warning: illegal bit-field type 'float _Complex' [35]
+msg_035.c(85): warning: illegal bit-field type 'double _Complex' [35]
+msg_035.c(87): warning: illegal bit-field type 'long double _Complex' [35]

Reply via email to