Module Name: src Committed By: rillig Date: Thu Jun 16 21:24:41 UTC 2022
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint: check-expect.lua src/tests/usr.bin/xlint/lint1: Makefile msg_202.c msg_202.exp msg_204.c msg_204.exp msg_205.c msg_205.exp msg_207.c msg_207.exp msg_208.c msg_208.exp msg_209.c msg_209.exp msg_210.c msg_210.exp msg_212.c msg_213.c msg_213.exp msg_216.c msg_217.c msg_217.exp msg_218.c msg_218.exp msg_220.c msg_220.exp msg_221.c msg_221.exp msg_223.c msg_223.exp msg_224.c msg_224.exp msg_225.c msg_225.exp msg_227.c msg_227.exp msg_228.c msg_228.exp msg_229.c msg_229.exp msg_231.c msg_231.exp msg_238.c msg_238.exp msg_239.c msg_239.exp msg_240.c msg_240.exp msg_241.c msg_241.exp msg_243.c msg_243.exp msg_244.c msg_244.exp msg_245.c msg_245.exp msg_246.c msg_246.exp msg_247.c msg_247.exp msg_248.c msg_248.exp msg_249.c msg_249.exp msg_255.c msg_255.exp msg_256.c msg_256.exp msg_258.c msg_258.exp msg_262.c msg_262.exp msg_263.c msg_263.exp msg_264.c msg_264.exp msg_266.c msg_266.exp msg_267.c msg_267.exp msg_275.c msg_275.exp msg_276.c msg_276.exp msg_277.c msg_277.exp msg_278.c msg_278.exp msg_279.c msg_279.exp msg_281.c msg_281.exp msg_282.c msg_282.exp msg_284.c msg_284.exp msg_285.c msg_285.exp msg_286.c msg_286.exp msg_287.c msg_287.exp msg_288.c msg_288.exp msg_290.c msg_290.exp msg_291.c msg_291.exp msg_293.c msg_293.exp msg_294.c msg_294.exp msg_295.c msg_295.exp msg_296.c msg_296.exp msg_299.c msg_299.exp Removed Files: src/tests/usr.bin/xlint/lint1: msg_212.exp Log Message: tests/lint: add more details to messages in msg_200 until msg_299 Add some tests that were previously empty. Some other tests are still empty. To generate a diff of this commit: cvs rdiff -u -r1.1213 -r1.1214 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/check-expect.lua cvs rdiff -u -r1.125 -r1.126 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_202.c \ src/tests/usr.bin/xlint/lint1/msg_202.exp \ src/tests/usr.bin/xlint/lint1/msg_205.c \ src/tests/usr.bin/xlint/lint1/msg_205.exp \ src/tests/usr.bin/xlint/lint1/msg_207.c \ src/tests/usr.bin/xlint/lint1/msg_207.exp \ src/tests/usr.bin/xlint/lint1/msg_208.c \ src/tests/usr.bin/xlint/lint1/msg_208.exp \ src/tests/usr.bin/xlint/lint1/msg_209.c \ src/tests/usr.bin/xlint/lint1/msg_209.exp \ src/tests/usr.bin/xlint/lint1/msg_212.c \ src/tests/usr.bin/xlint/lint1/msg_213.c \ src/tests/usr.bin/xlint/lint1/msg_213.exp \ src/tests/usr.bin/xlint/lint1/msg_218.c \ src/tests/usr.bin/xlint/lint1/msg_218.exp \ src/tests/usr.bin/xlint/lint1/msg_223.c \ src/tests/usr.bin/xlint/lint1/msg_223.exp \ src/tests/usr.bin/xlint/lint1/msg_225.c \ src/tests/usr.bin/xlint/lint1/msg_227.c \ src/tests/usr.bin/xlint/lint1/msg_227.exp \ src/tests/usr.bin/xlint/lint1/msg_228.c \ src/tests/usr.bin/xlint/lint1/msg_228.exp \ src/tests/usr.bin/xlint/lint1/msg_240.c \ src/tests/usr.bin/xlint/lint1/msg_240.exp \ src/tests/usr.bin/xlint/lint1/msg_243.c \ src/tests/usr.bin/xlint/lint1/msg_243.exp \ src/tests/usr.bin/xlint/lint1/msg_244.c \ src/tests/usr.bin/xlint/lint1/msg_244.exp \ src/tests/usr.bin/xlint/lint1/msg_246.c \ src/tests/usr.bin/xlint/lint1/msg_246.exp \ src/tests/usr.bin/xlint/lint1/msg_248.c \ src/tests/usr.bin/xlint/lint1/msg_248.exp \ src/tests/usr.bin/xlint/lint1/msg_255.c \ src/tests/usr.bin/xlint/lint1/msg_255.exp \ src/tests/usr.bin/xlint/lint1/msg_256.c \ src/tests/usr.bin/xlint/lint1/msg_256.exp \ src/tests/usr.bin/xlint/lint1/msg_258.c \ src/tests/usr.bin/xlint/lint1/msg_258.exp \ src/tests/usr.bin/xlint/lint1/msg_264.c \ src/tests/usr.bin/xlint/lint1/msg_264.exp \ src/tests/usr.bin/xlint/lint1/msg_266.c \ src/tests/usr.bin/xlint/lint1/msg_266.exp \ src/tests/usr.bin/xlint/lint1/msg_275.exp \ src/tests/usr.bin/xlint/lint1/msg_276.c \ src/tests/usr.bin/xlint/lint1/msg_276.exp \ src/tests/usr.bin/xlint/lint1/msg_278.exp \ src/tests/usr.bin/xlint/lint1/msg_279.exp \ src/tests/usr.bin/xlint/lint1/msg_281.c \ src/tests/usr.bin/xlint/lint1/msg_281.exp \ src/tests/usr.bin/xlint/lint1/msg_282.c \ src/tests/usr.bin/xlint/lint1/msg_282.exp \ src/tests/usr.bin/xlint/lint1/msg_284.c \ src/tests/usr.bin/xlint/lint1/msg_284.exp \ src/tests/usr.bin/xlint/lint1/msg_286.c \ src/tests/usr.bin/xlint/lint1/msg_286.exp \ src/tests/usr.bin/xlint/lint1/msg_287.c \ src/tests/usr.bin/xlint/lint1/msg_287.exp \ src/tests/usr.bin/xlint/lint1/msg_288.c \ src/tests/usr.bin/xlint/lint1/msg_288.exp \ src/tests/usr.bin/xlint/lint1/msg_290.c \ src/tests/usr.bin/xlint/lint1/msg_290.exp \ src/tests/usr.bin/xlint/lint1/msg_291.c \ src/tests/usr.bin/xlint/lint1/msg_291.exp \ src/tests/usr.bin/xlint/lint1/msg_293.c \ src/tests/usr.bin/xlint/lint1/msg_293.exp \ src/tests/usr.bin/xlint/lint1/msg_294.c \ src/tests/usr.bin/xlint/lint1/msg_294.exp \ src/tests/usr.bin/xlint/lint1/msg_295.c \ src/tests/usr.bin/xlint/lint1/msg_295.exp \ src/tests/usr.bin/xlint/lint1/msg_296.c \ src/tests/usr.bin/xlint/lint1/msg_296.exp \ src/tests/usr.bin/xlint/lint1/msg_299.c \ src/tests/usr.bin/xlint/lint1/msg_299.exp cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_204.c \ src/tests/usr.bin/xlint/lint1/msg_204.exp \ src/tests/usr.bin/xlint/lint1/msg_220.exp cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_210.c \ src/tests/usr.bin/xlint/lint1/msg_210.exp \ src/tests/usr.bin/xlint/lint1/msg_229.c \ src/tests/usr.bin/xlint/lint1/msg_239.c \ src/tests/usr.bin/xlint/lint1/msg_277.c cvs rdiff -u -r1.2 -r0 src/tests/usr.bin/xlint/lint1/msg_212.exp cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_216.c \ src/tests/usr.bin/xlint/lint1/msg_221.exp \ src/tests/usr.bin/xlint/lint1/msg_224.c \ src/tests/usr.bin/xlint/lint1/msg_224.exp \ src/tests/usr.bin/xlint/lint1/msg_225.exp \ src/tests/usr.bin/xlint/lint1/msg_229.exp \ src/tests/usr.bin/xlint/lint1/msg_231.c \ src/tests/usr.bin/xlint/lint1/msg_231.exp \ src/tests/usr.bin/xlint/lint1/msg_238.exp \ src/tests/usr.bin/xlint/lint1/msg_262.c \ src/tests/usr.bin/xlint/lint1/msg_262.exp \ src/tests/usr.bin/xlint/lint1/msg_263.c \ src/tests/usr.bin/xlint/lint1/msg_263.exp \ src/tests/usr.bin/xlint/lint1/msg_267.c \ src/tests/usr.bin/xlint/lint1/msg_267.exp \ src/tests/usr.bin/xlint/lint1/msg_277.exp \ src/tests/usr.bin/xlint/lint1/msg_278.c \ src/tests/usr.bin/xlint/lint1/msg_279.c \ src/tests/usr.bin/xlint/lint1/msg_285.c \ src/tests/usr.bin/xlint/lint1/msg_285.exp cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/msg_217.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_217.exp \ src/tests/usr.bin/xlint/lint1/msg_249.exp cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_220.c \ src/tests/usr.bin/xlint/lint1/msg_241.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_221.c \ src/tests/usr.bin/xlint/lint1/msg_238.c \ src/tests/usr.bin/xlint/lint1/msg_239.exp \ src/tests/usr.bin/xlint/lint1/msg_241.exp \ src/tests/usr.bin/xlint/lint1/msg_245.c \ src/tests/usr.bin/xlint/lint1/msg_245.exp \ src/tests/usr.bin/xlint/lint1/msg_275.c cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/xlint/lint1/msg_247.c cvs rdiff -u -r1.13 -r1.14 src/tests/usr.bin/xlint/lint1/msg_247.exp cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_249.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1213 src/distrib/sets/lists/tests/mi:1.1214 --- src/distrib/sets/lists/tests/mi:1.1213 Thu Jun 16 16:58:35 2022 +++ src/distrib/sets/lists/tests/mi Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1213 2022/06/16 16:58:35 rillig Exp $ +# $NetBSD: mi,v 1.1214 2022/06/16 21:24:41 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7002,7 +7002,7 @@ ./usr/tests/usr.bin/xlint/lint1/msg_211.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_211.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_212.c tests-usr.bin-tests compattestfile,atf -./usr/tests/usr.bin/xlint/lint1/msg_212.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_212.exp tests-obsolete obsolete,atf ./usr/tests/usr.bin/xlint/lint1/msg_213.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_213.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_214.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/check-expect.lua diff -u src/tests/usr.bin/xlint/check-expect.lua:1.16 src/tests/usr.bin/xlint/check-expect.lua:1.17 --- src/tests/usr.bin/xlint/check-expect.lua:1.16 Thu Jun 16 16:58:36 2022 +++ src/tests/usr.bin/xlint/check-expect.lua Thu Jun 16 21:24:41 2022 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: check-expect.lua,v 1.16 2022/06/16 16:58:36 rillig Exp $ +-- $NetBSD: check-expect.lua,v 1.17 2022/06/16 21:24:41 rillig Exp $ --[[ @@ -64,7 +64,7 @@ local function load_expect_comments_from -- 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 - if not fname:match("^msg_[01]") then + if not fname:match("^msg_[012]") then add_expectation(0, comment) end end Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.125 src/tests/usr.bin/xlint/lint1/Makefile:1.126 --- src/tests/usr.bin/xlint/lint1/Makefile:1.125 Thu Jun 16 16:58:36 2022 +++ src/tests/usr.bin/xlint/lint1/Makefile Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.125 2022/06/16 16:58:36 rillig Exp $ +# $NetBSD: Makefile,v 1.126 2022/06/16 21:24:41 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 349 # see lint1/err.c @@ -276,6 +276,7 @@ MSG_NO_EXP.040= yes MSG_NO_EXP.070= yes MSG_NO_EXP.131= yes MSG_NO_EXP.176= yes +MSG_NO_EXP.212= yes # Note: only works for adding tests. # To remove a test, the $$mi file must be edited manually. Index: src/tests/usr.bin/xlint/lint1/msg_202.c diff -u src/tests/usr.bin/xlint/lint1/msg_202.c:1.2 src/tests/usr.bin/xlint/lint1/msg_202.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_202.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_202.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,18 @@ -/* $NetBSD: msg_202.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_202.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_202.c" // Test for message: duplicate default in switch [202] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +void +example(int x) +{ + switch (x) { + case 1: + break; + default: + break; + default: + /* expect-1: error: duplicate default in switch [202] */ + return; + } +} Index: src/tests/usr.bin/xlint/lint1/msg_202.exp diff -u src/tests/usr.bin/xlint/lint1/msg_202.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_202.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_202.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_202.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_202.c(6): error: syntax error ':' [249] +msg_202.c(14): error: duplicate default in switch [202] Index: src/tests/usr.bin/xlint/lint1/msg_205.c diff -u src/tests/usr.bin/xlint/lint1/msg_205.c:1.2 src/tests/usr.bin/xlint/lint1/msg_205.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_205.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_205.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_205.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_205.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_205.c" // Test for message: switch expression must have integral type [205] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* ARGSUSED */ +void +example(double x) +{ + /* expect+1: error: switch expression must have integral type [205] */ + switch (x) { + } +} Index: src/tests/usr.bin/xlint/lint1/msg_205.exp diff -u src/tests/usr.bin/xlint/lint1/msg_205.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_205.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_205.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_205.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_205.c(6): error: syntax error ':' [249] +msg_205.c(11): error: switch expression must have integral type [205] Index: src/tests/usr.bin/xlint/lint1/msg_207.c diff -u src/tests/usr.bin/xlint/lint1/msg_207.c:1.2 src/tests/usr.bin/xlint/lint1/msg_207.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_207.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_207.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_207.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_207.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_207.c" // Test for message: loop not entered at top [207] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_207.exp diff -u src/tests/usr.bin/xlint/lint1/msg_207.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_207.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_207.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_207.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_207.c(6): error: syntax error ':' [249] +msg_207.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_208.c diff -u src/tests/usr.bin/xlint/lint1/msg_208.c:1.2 src/tests/usr.bin/xlint/lint1/msg_208.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_208.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_208.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_208.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_208.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_208.c" // Test for message: break outside loop or switch [208] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_208.exp diff -u src/tests/usr.bin/xlint/lint1/msg_208.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_208.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_208.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_208.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_208.c(6): error: syntax error ':' [249] +msg_208.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_209.c diff -u src/tests/usr.bin/xlint/lint1/msg_209.c:1.2 src/tests/usr.bin/xlint/lint1/msg_209.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_209.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_209.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,11 @@ -/* $NetBSD: msg_209.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_209.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_209.c" // Test for message: continue outside loop [209] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +void +example(void) +{ + /* expect+1: error: continue outside loop [209] */ + continue; +} Index: src/tests/usr.bin/xlint/lint1/msg_209.exp diff -u src/tests/usr.bin/xlint/lint1/msg_209.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_209.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_209.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_209.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_209.c(6): error: syntax error ':' [249] +msg_209.c(10): error: continue outside loop [209] Index: src/tests/usr.bin/xlint/lint1/msg_212.c diff -u src/tests/usr.bin/xlint/lint1/msg_212.c:1.2 src/tests/usr.bin/xlint/lint1/msg_212.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_212.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_212.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_212.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_212.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_212.c" // Test for message: cannot return incomplete type [212] +// 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." +int dummy; Index: src/tests/usr.bin/xlint/lint1/msg_213.c diff -u src/tests/usr.bin/xlint/lint1/msg_213.c:1.2 src/tests/usr.bin/xlint/lint1/msg_213.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_213.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_213.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,12 @@ -/* $NetBSD: msg_213.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_213.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_213.c" // Test for message: void function %s cannot return value [213] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+2: warning: argument 'x' unused in function 'example' [231] */ +void +example(int x) +{ + /* expect+1: error: void function example cannot return value [213] */ + return x; +} Index: src/tests/usr.bin/xlint/lint1/msg_213.exp diff -u src/tests/usr.bin/xlint/lint1/msg_213.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_213.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_213.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_213.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_213.c(6): error: syntax error ':' [249] +msg_213.c(11): error: void function example cannot return value [213] +msg_213.c(8): warning: argument 'x' unused in function 'example' [231] Index: src/tests/usr.bin/xlint/lint1/msg_218.c diff -u src/tests/usr.bin/xlint/lint1/msg_218.c:1.2 src/tests/usr.bin/xlint/lint1/msg_218.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_218.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_218.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_218.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_218.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_218.c" // Test for message: ANSI C treats constant as unsigned, op %s [218] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_218.exp diff -u src/tests/usr.bin/xlint/lint1/msg_218.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_218.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_218.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_218.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_218.c(6): error: syntax error ':' [249] +msg_218.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_223.c diff -u src/tests/usr.bin/xlint/lint1/msg_223.c:1.2 src/tests/usr.bin/xlint/lint1/msg_223.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_223.c:1.2 Sat Jan 30 17:02:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_223.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_223.c,v 1.2 2021/01/30 17:02:58 rillig Exp $ */ +/* $NetBSD: msg_223.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_223.c" // Test for message: end-of-loop code not reached [223] @@ -6,6 +6,7 @@ void example(int n) { - for (int i = 0; i < n; i++) /* expect: 223 */ + /* expect+1: warning: end-of-loop code not reached [223] */ + for (int i = 0; i < n; i++) break; } Index: src/tests/usr.bin/xlint/lint1/msg_223.exp diff -u src/tests/usr.bin/xlint/lint1/msg_223.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_223.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_223.exp:1.2 Sat Jan 30 17:02:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_223.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_223.c(9): warning: end-of-loop code not reached [223] +msg_223.c(10): warning: end-of-loop code not reached [223] Index: src/tests/usr.bin/xlint/lint1/msg_225.c diff -u src/tests/usr.bin/xlint/lint1/msg_225.c:1.2 src/tests/usr.bin/xlint/lint1/msg_225.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_225.c:1.2 Sun Jan 24 17:55:41 2021 +++ src/tests/usr.bin/xlint/lint1/msg_225.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_225.c,v 1.2 2021/01/24 17:55:41 rillig Exp $ */ +/* $NetBSD: msg_225.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_225.c" // Test for message: static function called but not defined: %s() [225] @@ -10,7 +10,8 @@ static void defined_later(void); void caller(void) { - undefined(); /* expect: 225 */ + /* expect+1: error: static function called but not defined: undefined() [225] */ + undefined(); defined_later(); } Index: src/tests/usr.bin/xlint/lint1/msg_227.c diff -u src/tests/usr.bin/xlint/lint1/msg_227.c:1.2 src/tests/usr.bin/xlint/lint1/msg_227.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_227.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_227.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_227.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_227.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_227.c" // Test for message: const object %s should have initializer [227] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+2: warning: static variable 'without_initializer' unused [226] */ +/* expect+1: warning: const object without_initializer should have initializer [227] */ +static const int without_initializer; +/* expect+1: warning: static variable 'with_initializer' unused [226] */ +static const int with_initializer = 1; Index: src/tests/usr.bin/xlint/lint1/msg_227.exp diff -u src/tests/usr.bin/xlint/lint1/msg_227.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_227.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_227.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_227.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,3 @@ -msg_227.c(6): error: syntax error ':' [249] +msg_227.c(8): warning: static variable 'without_initializer' unused [226] +msg_227.c(8): warning: const object without_initializer should have initializer [227] +msg_227.c(10): warning: static variable 'with_initializer' unused [226] Index: src/tests/usr.bin/xlint/lint1/msg_228.c diff -u src/tests/usr.bin/xlint/lint1/msg_228.c:1.2 src/tests/usr.bin/xlint/lint1/msg_228.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_228.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_228.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,21 @@ -/* $NetBSD: msg_228.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_228.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_228.c" -// Test for message: function cannot return const or volatile object [228] +/* Test for message: function cannot return const or volatile object [228] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* TODO: Also warn in C99 mode and later. */ +/* lint1-flags: -sw */ + +const int +return_const_int(void) +/* expect+1: warning: function cannot return const or volatile object [228] */ +{ + return 3; +} + +volatile int +return_volatile_int(void) +/* expect+1: warning: function cannot return const or volatile object [228] */ +{ + return 3; +} Index: src/tests/usr.bin/xlint/lint1/msg_228.exp diff -u src/tests/usr.bin/xlint/lint1/msg_228.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_228.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_228.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_228.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_228.c(6): error: syntax error ':' [249] +msg_228.c(12): warning: function cannot return const or volatile object [228] +msg_228.c(19): warning: function cannot return const or volatile object [228] Index: src/tests/usr.bin/xlint/lint1/msg_240.c diff -u src/tests/usr.bin/xlint/lint1/msg_240.c:1.2 src/tests/usr.bin/xlint/lint1/msg_240.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_240.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_240.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,47 @@ -/* $NetBSD: msg_240.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_240.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_240.c" // Test for message: assignment of different structures (%s != %s) [240] +// This message is not used. +// TODO: Remove the code, as the message is unreachable. -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +struct s_arg { + int member; +}; + +struct s_local { + int member; +}; + +struct s_return { + int member; +}; + +union u_arg { + int member; +}; + +/* expect+2: warning: argument 's_arg' unused in function 'return_other_struct' [231] */ +struct s_return +return_other_struct(struct s_arg s_arg) +{ + /* XXX: No warning? */ + return s_arg; +} + +/* expect+2: warning: argument 's_arg' unused in function 'assign_other_struct' [231] */ +void +assign_other_struct(struct s_arg s_arg) +{ + static struct s_local s_local; + /* XXX: No warning? */ + s_local = s_arg; +} + +/* expect+2: warning: argument 'u_arg' unused in function 'return_other_union' [231] */ +struct s_return +return_other_union(union u_arg u_arg) +{ + /* XXX: No warning? */ + return u_arg; +} Index: src/tests/usr.bin/xlint/lint1/msg_240.exp diff -u src/tests/usr.bin/xlint/lint1/msg_240.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_240.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_240.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_240.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,3 @@ -msg_240.c(6): error: syntax error ':' [249] +msg_240.c(26): warning: argument 's_arg' unused in function 'return_other_struct' [231] +msg_240.c(34): warning: argument 's_arg' unused in function 'assign_other_struct' [231] +msg_240.c(43): warning: argument 'u_arg' unused in function 'return_other_union' [231] Index: src/tests/usr.bin/xlint/lint1/msg_243.c diff -u src/tests/usr.bin/xlint/lint1/msg_243.c:1.2 src/tests/usr.bin/xlint/lint1/msg_243.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_243.c:1.2 Sun Jan 31 09:21:24 2021 +++ src/tests/usr.bin/xlint/lint1/msg_243.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_243.c,v 1.2 2021/01/31 09:21:24 rillig Exp $ */ +/* $NetBSD: msg_243.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_243.c" // Test for message: dubious comparison of enums, op %s [243] @@ -16,10 +16,14 @@ void eval(_Bool); void example(enum color a, enum color b) { - eval(a < b); /* expect: 243 */ - eval(a <= b); /* expect: 243 */ - eval(a > b); /* expect: 243 */ - eval(a >= b); /* expect: 243 */ + /* expect+1: warning: dubious comparison of enums, op < [243] */ + eval(a < b); + /* expect+1: warning: dubious comparison of enums, op <= [243] */ + eval(a <= b); + /* expect+1: warning: dubious comparison of enums, op > [243] */ + eval(a > b); + /* expect+1: warning: dubious comparison of enums, op >= [243] */ + eval(a >= b); eval(a == b); eval(a != b); } Index: src/tests/usr.bin/xlint/lint1/msg_243.exp diff -u src/tests/usr.bin/xlint/lint1/msg_243.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_243.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_243.exp:1.2 Sun Jan 31 09:21:24 2021 +++ src/tests/usr.bin/xlint/lint1/msg_243.exp Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -msg_243.c(19): warning: dubious comparison of enums, op < [243] -msg_243.c(20): warning: dubious comparison of enums, op <= [243] -msg_243.c(21): warning: dubious comparison of enums, op > [243] -msg_243.c(22): warning: dubious comparison of enums, op >= [243] +msg_243.c(20): warning: dubious comparison of enums, op < [243] +msg_243.c(22): warning: dubious comparison of enums, op <= [243] +msg_243.c(24): warning: dubious comparison of enums, op > [243] +msg_243.c(26): warning: dubious comparison of enums, op >= [243] Index: src/tests/usr.bin/xlint/lint1/msg_244.c diff -u src/tests/usr.bin/xlint/lint1/msg_244.c:1.2 src/tests/usr.bin/xlint/lint1/msg_244.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_244.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_244.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,33 @@ -/* $NetBSD: msg_244.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_244.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_244.c" // Test for message: illegal structure pointer combination [244] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +struct a { + int member; +}; + +struct b { + int member; +}; + +int +diff(struct a *a, struct b *b) +{ + /* expect+1: error: illegal pointer subtraction [116] */ + return a - b; +} + +_Bool +lt(struct a *a, struct b *b) +{ + /* expect+1: warning: incompatible structure pointers: 'pointer to struct a' '<' 'pointer to struct b' [245] */ + return a < b; +} + +struct a * +ret(struct b *b) +{ + /* expect+1: warning: illegal structure pointer combination [244] */ + return b; +} Index: src/tests/usr.bin/xlint/lint1/msg_244.exp diff -u src/tests/usr.bin/xlint/lint1/msg_244.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_244.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_244.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_244.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,3 @@ -msg_244.c(6): error: syntax error ':' [249] +msg_244.c(18): error: illegal pointer subtraction [116] +msg_244.c(25): warning: incompatible structure pointers: 'pointer to struct a' '<' 'pointer to struct b' [245] +msg_244.c(32): warning: illegal structure pointer combination [244] Index: src/tests/usr.bin/xlint/lint1/msg_246.c diff -u src/tests/usr.bin/xlint/lint1/msg_246.c:1.2 src/tests/usr.bin/xlint/lint1/msg_246.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_246.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_246.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,22 @@ -/* $NetBSD: msg_246.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_246.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_246.c" // Test for message: dubious conversion of enum to '%s' [246] +// 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." +enum color { + RED, GREEN, BLUE +}; + +double +to_double(enum color c) +{ + return c; +} + +void * +to_pointer(enum color c) +{ + /* expect+1: warning: illegal combination of pointer (pointer to void) and integer (enum color) [183] */ + return c; +} Index: src/tests/usr.bin/xlint/lint1/msg_246.exp diff -u src/tests/usr.bin/xlint/lint1/msg_246.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_246.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_246.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_246.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_246.c(6): error: syntax error ':' [249] +msg_246.c(21): warning: illegal combination of pointer (pointer to void) and integer (enum color) [183] Index: src/tests/usr.bin/xlint/lint1/msg_248.c diff -u src/tests/usr.bin/xlint/lint1/msg_248.c:1.2 src/tests/usr.bin/xlint/lint1/msg_248.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_248.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_248.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_248.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_248.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_248.c" // Test for message: floating-point constant out of range [248] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_248.exp diff -u src/tests/usr.bin/xlint/lint1/msg_248.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_248.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_248.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_248.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_248.c(6): error: syntax error ':' [249] +msg_248.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_255.c diff -u src/tests/usr.bin/xlint/lint1/msg_255.c:1.2 src/tests/usr.bin/xlint/lint1/msg_255.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_255.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_255.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,11 @@ -/* $NetBSD: msg_255.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_255.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_255.c" // Test for message: undefined or invalid # directive [255] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +#pragma once + +/* expect+1: warning: undefined or invalid # directive [255] */ +#fatal_error + +int dummy; Index: src/tests/usr.bin/xlint/lint1/msg_255.exp diff -u src/tests/usr.bin/xlint/lint1/msg_255.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_255.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_255.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_255.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_255.c(6): error: syntax error ':' [249] +msg_255.c(9): warning: undefined or invalid # directive [255] Index: src/tests/usr.bin/xlint/lint1/msg_256.c diff -u src/tests/usr.bin/xlint/lint1/msg_256.c:1.2 src/tests/usr.bin/xlint/lint1/msg_256.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_256.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_256.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_256.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_256.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_256.c" // Test for message: unterminated comment [256] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +int dummy; + +/* expect+2: error: unterminated comment [256] */ +/* This comment never ends. Index: src/tests/usr.bin/xlint/lint1/msg_256.exp diff -u src/tests/usr.bin/xlint/lint1/msg_256.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_256.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_256.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_256.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_256.c(6): error: syntax error ':' [249] +msg_256.c(10): error: unterminated comment [256] Index: src/tests/usr.bin/xlint/lint1/msg_258.c diff -u src/tests/usr.bin/xlint/lint1/msg_258.c:1.2 src/tests/usr.bin/xlint/lint1/msg_258.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_258.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_258.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,16 @@ -/* $NetBSD: msg_258.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_258.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_258.c" // Test for message: unterminated string constant [258] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +int dummy; + +// A string literal that is not finished at the end of the line confuses the +// parser. +// +// "This string doesn't end in this line. + +/* expect+4: error: unterminated string constant [258] */ +/* expect+3: error: syntax error '' [249] */ +/* expect+2: error: empty array declaration: str [190] */ +const char str[] = "This is the end. Index: src/tests/usr.bin/xlint/lint1/msg_258.exp diff -u src/tests/usr.bin/xlint/lint1/msg_258.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_258.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_258.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_258.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,3 @@ -msg_258.c(6): error: syntax error ':' [249] +msg_258.c(17): error: unterminated string constant [258] +msg_258.c(17): error: syntax error '' [249] +msg_258.c(17): error: empty array declaration: str [190] Index: src/tests/usr.bin/xlint/lint1/msg_264.c diff -u src/tests/usr.bin/xlint/lint1/msg_264.c:1.2 src/tests/usr.bin/xlint/lint1/msg_264.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_264.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_264.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_264.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_264.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_264.c" -// Test for message: \v undefined in traditional C [264] +/* Test for message: \v undefined in traditional C [264] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -tw */ + +/* expect+1: warning: \v undefined in traditional C [264] */ +char str[] = "vertical \v tab"; Index: src/tests/usr.bin/xlint/lint1/msg_264.exp diff -u src/tests/usr.bin/xlint/lint1/msg_264.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_264.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_264.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_264.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_264.c(6): error: syntax error ':' [249] +msg_264.c(9): warning: \v undefined in traditional C [264] Index: src/tests/usr.bin/xlint/lint1/msg_266.c diff -u src/tests/usr.bin/xlint/lint1/msg_266.c:1.2 src/tests/usr.bin/xlint/lint1/msg_266.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_266.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_266.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_266.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_266.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_266.c" -// Test for message: 'long double' is illegal in traditional C [266] +/* Test for message: 'long double' is illegal in traditional C [266] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -tw */ + +/* expect+1: warning: 'long double' is illegal in traditional C [266] */ +long double ldbl = 0.0; Index: src/tests/usr.bin/xlint/lint1/msg_266.exp diff -u src/tests/usr.bin/xlint/lint1/msg_266.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_266.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_266.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_266.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_266.c(6): error: syntax error ':' [249] +msg_266.c(9): warning: 'long double' is illegal in traditional C [266] Index: src/tests/usr.bin/xlint/lint1/msg_275.exp diff -u src/tests/usr.bin/xlint/lint1/msg_275.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_275.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_275.exp:1.2 Sun Feb 28 01:36:46 2021 +++ src/tests/usr.bin/xlint/lint1/msg_275.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_275.c(11): warning: cast discards 'const' from type 'pointer to const char' [275] +msg_275.c(12): warning: cast discards 'const' from type 'pointer to const char' [275] Index: src/tests/usr.bin/xlint/lint1/msg_276.c diff -u src/tests/usr.bin/xlint/lint1/msg_276.c:1.2 src/tests/usr.bin/xlint/lint1/msg_276.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_276.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_276.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_276.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_276.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_276.c" // Test for message: __%s__ is illegal for type %s [276] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: error: __real__ is illegal for type double [276] */ +int real_int = __real__ 0.0; +/* expect+1: error: __imag__ is illegal for type double [276] */ +int imag_int = __imag__ 0.0; Index: src/tests/usr.bin/xlint/lint1/msg_276.exp diff -u src/tests/usr.bin/xlint/lint1/msg_276.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_276.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_276.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_276.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_276.c(6): error: syntax error ':' [249] +msg_276.c(7): error: __real__ is illegal for type double [276] +msg_276.c(9): error: __imag__ is illegal for type double [276] Index: src/tests/usr.bin/xlint/lint1/msg_278.exp diff -u src/tests/usr.bin/xlint/lint1/msg_278.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_278.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_278.exp:1.2 Sat Feb 27 18:01:29 2021 +++ src/tests/usr.bin/xlint/lint1/msg_278.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_278.c(19): warning: combination of 'enum E' and 'int', arg #1 [278] -msg_278.c(21): warning: combination of 'int' and 'enum E', arg #1 [278] +msg_278.c(20): warning: combination of 'enum E' and 'int', arg #1 [278] +msg_278.c(23): warning: combination of 'int' and 'enum E', arg #1 [278] Index: src/tests/usr.bin/xlint/lint1/msg_279.exp diff -u src/tests/usr.bin/xlint/lint1/msg_279.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_279.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_279.exp:1.2 Sat Feb 27 18:01:29 2021 +++ src/tests/usr.bin/xlint/lint1/msg_279.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_279.c(18): warning: combination of 'enum E' and 'int' in return [279] -msg_279.c(24): warning: combination of 'int' and 'enum E' in return [279] +msg_279.c(19): warning: combination of 'enum E' and 'int' in return [279] +msg_279.c(26): warning: combination of 'int' and 'enum E' in return [279] Index: src/tests/usr.bin/xlint/lint1/msg_281.c diff -u src/tests/usr.bin/xlint/lint1/msg_281.c:1.2 src/tests/usr.bin/xlint/lint1/msg_281.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_281.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_281.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_281.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_281.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_281.c" // Test for message: duplicate use of /* %s */ [281] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: duplicate use of ** ARGSUSED ** [281] */ +/* ARGSUSED *//* ARGSUSED */ +void args_used(int x) +{ +} Index: src/tests/usr.bin/xlint/lint1/msg_281.exp diff -u src/tests/usr.bin/xlint/lint1/msg_281.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_281.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_281.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_281.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_281.c(6): error: syntax error ':' [249] +msg_281.c(7): warning: duplicate use of /* ARGSUSED */ [281] Index: src/tests/usr.bin/xlint/lint1/msg_282.c diff -u src/tests/usr.bin/xlint/lint1/msg_282.c:1.2 src/tests/usr.bin/xlint/lint1/msg_282.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_282.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_282.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,20 @@ -/* $NetBSD: msg_282.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_282.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_282.c" // Test for message: must precede function definition: /* %s */ [282] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: must precede function definition: ** ARGSUSED ** [282] */ +/* ARGSUSED */ +int argsused; + +/* expect+1: warning: must precede function definition: ** VARARGS ** [282] */ +/* VARARGS */ +int varargs; + +/* expect+1: warning: must precede function definition: ** PRINTFLIKE ** [282] */ +/* PRINTFLIKE */ +int printflike; + +/* expect+1: warning: must precede function definition: ** SCANFLIKE ** [282] */ +/* SCANFLIKE */ +int scanflike; Index: src/tests/usr.bin/xlint/lint1/msg_282.exp diff -u src/tests/usr.bin/xlint/lint1/msg_282.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_282.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_282.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_282.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,4 @@ -msg_282.c(6): error: syntax error ':' [249] +msg_282.c(7): warning: must precede function definition: /* ARGSUSED */ [282] +msg_282.c(11): warning: must precede function definition: /* VARARGS */ [282] +msg_282.c(15): warning: must precede function definition: /* PRINTFLIKE */ [282] +msg_282.c(19): warning: must precede function definition: /* SCANFLIKE */ [282] Index: src/tests/usr.bin/xlint/lint1/msg_284.c diff -u src/tests/usr.bin/xlint/lint1/msg_284.c:1.2 src/tests/usr.bin/xlint/lint1/msg_284.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_284.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_284.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,23 @@ -/* $NetBSD: msg_284.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_284.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_284.c" // Test for message: fallthrough on default statement [284] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-extra-flags: -h */ + +void print_int(int); + +void +example(int x) +{ + switch (x) { + case 1: + print_int(x); + /* expect+1: warning: fallthrough on default statement [284] */ + default: + print_int(0); + /* expect+1: warning: fallthrough on case statement [220] */ + case 2: + print_int(x); + } +} Index: src/tests/usr.bin/xlint/lint1/msg_284.exp diff -u src/tests/usr.bin/xlint/lint1/msg_284.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_284.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_284.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_284.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_284.c(6): error: syntax error ':' [249] +msg_284.c(17): warning: fallthrough on default statement [284] +msg_284.c(20): warning: fallthrough on case statement [220] Index: src/tests/usr.bin/xlint/lint1/msg_286.c diff -u src/tests/usr.bin/xlint/lint1/msg_286.c:1.2 src/tests/usr.bin/xlint/lint1/msg_286.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_286.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_286.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_286.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_286.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_286.c" // Test for message: function definition is not a prototype [286] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_286.exp diff -u src/tests/usr.bin/xlint/lint1/msg_286.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_286.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_286.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_286.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_286.c(6): error: syntax error ':' [249] +msg_286.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_287.c diff -u src/tests/usr.bin/xlint/lint1/msg_287.c:1.2 src/tests/usr.bin/xlint/lint1/msg_287.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_287.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_287.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_287.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_287.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_287.c" // Test for message: function declaration is not a prototype [287] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_287.exp diff -u src/tests/usr.bin/xlint/lint1/msg_287.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_287.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_287.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_287.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_287.c(6): error: syntax error ':' [249] +msg_287.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_288.c diff -u src/tests/usr.bin/xlint/lint1/msg_288.c:1.2 src/tests/usr.bin/xlint/lint1/msg_288.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_288.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_288.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,24 @@ -/* $NetBSD: msg_288.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_288.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_288.c" // Test for message: dubious use of /* VARARGS */ with /* %s */ [288] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* VARARGS */ +int +just_varargs(char x) +{ + /* + * No warning here, even though having a VARARGS annotation on a + * function that is incompatible to varargs is dubious. + */ + return x; +} + +/* VARARGS */ +/* PRINTFLIKE */ +int +example(int x) +/* expect+1: warning: dubious use of ** VARARGS ** with ** PRINTFLIKE ** [288] */ +{ + return x; +} Index: src/tests/usr.bin/xlint/lint1/msg_288.exp diff -u src/tests/usr.bin/xlint/lint1/msg_288.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_288.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_288.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_288.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_288.c(6): error: syntax error ':' [249] +msg_288.c(22): warning: dubious use of /* VARARGS */ with /* PRINTFLIKE */ [288] Index: src/tests/usr.bin/xlint/lint1/msg_290.c diff -u src/tests/usr.bin/xlint/lint1/msg_290.c:1.2 src/tests/usr.bin/xlint/lint1/msg_290.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_290.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_290.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,15 @@ -/* $NetBSD: msg_290.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_290.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_290.c" // Test for message: static function %s declared but not defined [290] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: static function only_declared declared but not defined [290] */ +static void only_declared(void); +static void declared_and_called(void); + +void +use_function(void) +{ + /* expect+1: error: static function called but not defined: declared_and_called() [225] */ + declared_and_called(); +} Index: src/tests/usr.bin/xlint/lint1/msg_290.exp diff -u src/tests/usr.bin/xlint/lint1/msg_290.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_290.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_290.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_290.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_290.c(6): error: syntax error ':' [249] +msg_290.c(7): warning: static function only_declared declared but not defined [290] +msg_290.c(14): error: static function called but not defined: declared_and_called() [225] Index: src/tests/usr.bin/xlint/lint1/msg_291.c diff -u src/tests/usr.bin/xlint/lint1/msg_291.c:1.2 src/tests/usr.bin/xlint/lint1/msg_291.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_291.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_291.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_291.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_291.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_291.c" // Test for message: invalid multibyte character [291] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +char foreign[] = "\x80\xC3\x76"; + +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_291.exp diff -u src/tests/usr.bin/xlint/lint1/msg_291.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_291.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_291.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_291.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_291.c(6): error: syntax error ':' [249] +msg_291.c(9): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_293.c diff -u src/tests/usr.bin/xlint/lint1/msg_293.c:1.2 src/tests/usr.bin/xlint/lint1/msg_293.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_293.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_293.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,10 @@ -/* $NetBSD: msg_293.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_293.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_293.c" // Test for message: argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE [293] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+3: warning: argument 1 must be 'char *' for PRINTFLIKE/SCANFLIKE [293] */ +/* expect+2: warning: argument 'msgid' unused in function 'my_printf' [231] */ +/* PRINTFLIKE 1 */ +void my_printf(int msgid, ...) { +} Index: src/tests/usr.bin/xlint/lint1/msg_293.exp diff -u src/tests/usr.bin/xlint/lint1/msg_293.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_293.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_293.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_293.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_293.c(6): error: syntax error ':' [249] +msg_293.c(9): warning: argument 1 must be 'char *' for PRINTFLIKE/SCANFLIKE [293] +msg_293.c(9): warning: argument 'msgid' unused in function 'my_printf' [231] Index: src/tests/usr.bin/xlint/lint1/msg_294.c diff -u src/tests/usr.bin/xlint/lint1/msg_294.c:1.2 src/tests/usr.bin/xlint/lint1/msg_294.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_294.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_294.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_294.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_294.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_294.c" // Test for message: multi-character character constant [294] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+2: warning: multi-character character constant [294] */ +/* expect+1: warning: initializer does not fit [178] */ +char ch = '1234'; Index: src/tests/usr.bin/xlint/lint1/msg_294.exp diff -u src/tests/usr.bin/xlint/lint1/msg_294.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_294.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_294.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_294.exp Thu Jun 16 21:24:41 2022 @@ -1 +1,2 @@ -msg_294.c(6): error: syntax error ':' [249] +msg_294.c(8): warning: multi-character character constant [294] +msg_294.c(8): warning: initializer does not fit [178] Index: src/tests/usr.bin/xlint/lint1/msg_295.c diff -u src/tests/usr.bin/xlint/lint1/msg_295.c:1.2 src/tests/usr.bin/xlint/lint1/msg_295.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_295.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_295.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_295.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_295.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_295.c" // Test for message: conversion of '%s' to '%s' is out of range, arg #%d [295] -TODO: "Add example code that triggers the above message." /* expect: 249 */ +/* expect+1: error: syntax error ':' [249] */ +TODO: "Add example code that triggers the above message." TODO: "Add example code that almost triggers the above message." Index: src/tests/usr.bin/xlint/lint1/msg_295.exp diff -u src/tests/usr.bin/xlint/lint1/msg_295.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_295.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_295.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_295.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_295.c(6): error: syntax error ':' [249] +msg_295.c(7): error: syntax error ':' [249] Index: src/tests/usr.bin/xlint/lint1/msg_296.c diff -u src/tests/usr.bin/xlint/lint1/msg_296.c:1.2 src/tests/usr.bin/xlint/lint1/msg_296.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_296.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_296.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_296.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_296.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_296.c" // Test for message: conversion of negative constant to unsigned type, arg #%d [296] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +void take_unsigned_int(unsigned int); + +void +example(void) +{ + /* expect+1: warning: conversion of negative constant to unsigned type, arg #1 [296] */ + take_unsigned_int(-3); +} Index: src/tests/usr.bin/xlint/lint1/msg_296.exp diff -u src/tests/usr.bin/xlint/lint1/msg_296.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_296.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_296.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_296.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_296.c(6): error: syntax error ':' [249] +msg_296.c(12): warning: conversion of negative constant to unsigned type, arg #1 [296] Index: src/tests/usr.bin/xlint/lint1/msg_299.c diff -u src/tests/usr.bin/xlint/lint1/msg_299.c:1.2 src/tests/usr.bin/xlint/lint1/msg_299.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_299.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_299.c Thu Jun 16 21:24:41 2022 @@ -1,7 +1,15 @@ -/* $NetBSD: msg_299.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_299.c,v 1.3 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_299.c" -// Test for message: prototype does not match old style definition, arg #%d [299] +/* Test for message: prototype does not match old style definition, arg #%d [299] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -w */ + +old_style(x) + double x; +{ + return x > 0.0; +} + +/* expect+1: error: prototype does not match old style definition, arg #1 [299] */ +void old_style(char ch); Index: src/tests/usr.bin/xlint/lint1/msg_299.exp diff -u src/tests/usr.bin/xlint/lint1/msg_299.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_299.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_299.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_299.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_299.c(6): error: syntax error ':' [249] +msg_299.c(15): error: prototype does not match old style definition, arg #1 [299] Index: src/tests/usr.bin/xlint/lint1/msg_204.c diff -u src/tests/usr.bin/xlint/lint1/msg_204.c:1.6 src/tests/usr.bin/xlint/lint1/msg_204.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_204.c:1.6 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_204.c Thu Jun 16 21:24:41 2022 @@ -1,8 +1,11 @@ -/* $NetBSD: msg_204.c,v 1.6 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_204.c,v 1.7 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_204.c" // Test for message: controlling expressions must have scalar type [204] +/* Suppress message "argument '%s' unused in function '%s'". */ +/* lint1-extra-flags: -X 231 */ + extern void extern_function(void); @@ -84,18 +87,26 @@ void if_enum(enum e e) { if (e) return /* C99 6.2.5p20 */ void if_array(struct arr arr) { if (arr.arr) return; } -void if_struct(struct s s) { if (s) return; } /* expect: 204 *//* expect: 231 */ -void if_union(union u u) { if (u) return; } /* expect: 204 *//* expect: 231 */ +/* expect+1: error: controlling expressions must have scalar type [204] */ +void if_struct(struct s s) { if (s) return; } +/* expect+1: error: controlling expressions must have scalar type [204] */ +void if_union(union u u) { if (u) return; } void if_function(void) { if (if_function) return; } void if_pointer(void *p) { if (p) return; } /* C99 6.8.5 */ -void while_struct(struct s s) { while (s) return; } /* expect: 204 *//* expect: 231 */ -void for_struct(struct s s) { for (;s;) return; } /* expect: 204 *//* expect: 223 *//* expect: 231 */ -void do_while_struct(struct s s) { do { return; } while (s); } /* expect: 204 *//* expect: 231 */ +/* expect+1: error: controlling expressions must have scalar type [204] */ +void while_struct(struct s s) { while (s) return; } +/* expect+2: error: controlling expressions must have scalar type [204] */ +/* expect+1: warning: end-of-loop code not reached [223] */ +void for_struct(struct s s) { for (;s;) return; } +/* expect+1: error: controlling expressions must have scalar type [204] */ +void do_while_struct(struct s s) { do { return; } while (s); } /* * C99 6.5.15 for the '?:' operator does not explicitly mention that the * controlling expression must have a scalar type, curiously. */ -int conditional_struct(struct s s) { return s ? 1 : 2; } /* expect: 170 *//* expect: 214 *//* expect: 231 */ +/* expect+2: error: first operand must have scalar type, op ? : [170] */ +/* expect+1: warning: function 'conditional_struct' expects to return value [214] */ +int conditional_struct(struct s s) { return s ? 1 : 2; } Index: src/tests/usr.bin/xlint/lint1/msg_204.exp diff -u src/tests/usr.bin/xlint/lint1/msg_204.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_204.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_204.exp:1.6 Tue Aug 3 18:44:33 2021 +++ src/tests/usr.bin/xlint/lint1/msg_204.exp Thu Jun 16 21:24:41 2022 @@ -1,14 +1,8 @@ -msg_204.c(87): error: controlling expressions must have scalar type [204] -msg_204.c(87): warning: argument 's' unused in function 'if_struct' [231] -msg_204.c(88): error: controlling expressions must have scalar type [204] -msg_204.c(88): warning: argument 'u' unused in function 'if_union' [231] +msg_204.c(91): error: controlling expressions must have scalar type [204] msg_204.c(93): error: controlling expressions must have scalar type [204] -msg_204.c(93): warning: argument 's' unused in function 'while_struct' [231] -msg_204.c(94): error: controlling expressions must have scalar type [204] -msg_204.c(94): warning: end-of-loop code not reached [223] -msg_204.c(94): warning: argument 's' unused in function 'for_struct' [231] -msg_204.c(95): error: controlling expressions must have scalar type [204] -msg_204.c(95): warning: argument 's' unused in function 'do_while_struct' [231] -msg_204.c(101): error: first operand must have scalar type, op ? : [170] -msg_204.c(101): warning: function 'conditional_struct' expects to return value [214] -msg_204.c(101): warning: argument 's' unused in function 'conditional_struct' [231] +msg_204.c(99): error: controlling expressions must have scalar type [204] +msg_204.c(102): error: controlling expressions must have scalar type [204] +msg_204.c(102): warning: end-of-loop code not reached [223] +msg_204.c(104): error: controlling expressions must have scalar type [204] +msg_204.c(112): error: first operand must have scalar type, op ? : [170] +msg_204.c(112): warning: function 'conditional_struct' expects to return value [214] Index: src/tests/usr.bin/xlint/lint1/msg_220.exp diff -u src/tests/usr.bin/xlint/lint1/msg_220.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_220.exp:1.7 --- src/tests/usr.bin/xlint/lint1/msg_220.exp:1.6 Sun Aug 29 09:29:32 2021 +++ src/tests/usr.bin/xlint/lint1/msg_220.exp Thu Jun 16 21:24:41 2022 @@ -1,5 +1,5 @@ -msg_220.c(19): warning: fallthrough on case statement [220] -msg_220.c(22): warning: fallthrough on default statement [284] -msg_220.c(62): warning: fallthrough on case statement [220] -msg_220.c(66): warning: fallthrough on case statement [220] -msg_220.c(71): warning: fallthrough on case statement [220] +msg_220.c(20): warning: fallthrough on case statement [220] +msg_220.c(24): warning: fallthrough on default statement [284] +msg_220.c(64): warning: fallthrough on case statement [220] +msg_220.c(68): warning: fallthrough on case statement [220] +msg_220.c(73): warning: fallthrough on case statement [220] Index: src/tests/usr.bin/xlint/lint1/msg_210.c diff -u src/tests/usr.bin/xlint/lint1/msg_210.c:1.5 src/tests/usr.bin/xlint/lint1/msg_210.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_210.c:1.5 Sun Feb 28 12:40:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_210.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_210.c,v 1.5 2021/02/28 12:40:00 rillig Exp $ */ +/* $NetBSD: msg_210.c,v 1.6 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_210.c" // Test for message: enum type mismatch between '%s' and '%s' in initialization [210] @@ -20,6 +20,8 @@ typedef enum { } D; enum A a1 = A1; -enum A a2 = B1; /* expect: 210 */ +/* expect+1: warning: enum type mismatch between 'enum A' and 'enum B' in initialization [210] */ +enum A a2 = B1; C c1 = C1; -C c2 = D1; /* expect: 210 */ +/* expect+1: warning: enum type mismatch between 'enum typedef C' and 'enum typedef D' in initialization [210] */ +C c2 = D1; Index: src/tests/usr.bin/xlint/lint1/msg_210.exp diff -u src/tests/usr.bin/xlint/lint1/msg_210.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_210.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_210.exp:1.5 Sun Feb 28 02:29:28 2021 +++ src/tests/usr.bin/xlint/lint1/msg_210.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_210.c(23): warning: enum type mismatch between 'enum A' and 'enum B' in initialization [210] -msg_210.c(25): warning: enum type mismatch between 'enum typedef C' and 'enum typedef D' in initialization [210] +msg_210.c(24): warning: enum type mismatch between 'enum A' and 'enum B' in initialization [210] +msg_210.c(27): warning: enum type mismatch between 'enum typedef C' and 'enum typedef D' in initialization [210] Index: src/tests/usr.bin/xlint/lint1/msg_229.c diff -u src/tests/usr.bin/xlint/lint1/msg_229.c:1.5 src/tests/usr.bin/xlint/lint1/msg_229.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_229.c:1.5 Sun Feb 28 01:20:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_229.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_229.c,v 1.5 2021/02/28 01:20:54 rillig Exp $ */ +/* $NetBSD: msg_229.c,v 1.6 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_229.c" // Test for message: converting '%s' to '%s' is questionable [229] @@ -8,11 +8,13 @@ typedef double (*unary_operator)(double) int * to_int_pointer(unary_operator op) { - return (int *)op; /* expect: 229 */ + /* expect+1: warning: converting 'pointer to function(double) returning double' to 'pointer to int' is questionable [229] */ + return (int *)op; } unary_operator to_function_pointer(int *p) { - return (unary_operator)p; /* expect: 229 */ + /* expect+1: warning: converting 'pointer to int' to 'pointer to function(double) returning double' is questionable [229] */ + return (unary_operator)p; } Index: src/tests/usr.bin/xlint/lint1/msg_239.c diff -u src/tests/usr.bin/xlint/lint1/msg_239.c:1.5 src/tests/usr.bin/xlint/lint1/msg_239.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_239.c:1.5 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_239.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_239.c,v 1.5 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_239.c,v 1.6 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_239.c" // Test for message: constant argument to '!' [239] @@ -10,8 +10,12 @@ example(int n) { _Bool b; - b = !0; /* expect: constant in conditional context *//* expect: 239 */ - b = !1; /* expect: constant in conditional context *//* expect: 239 */ + /* expect+2: warning: constant in conditional context [161] */ + /* expect+1: warning: constant argument to '!' [239] */ + b = !0; + /* expect+2: warning: constant in conditional context [161] */ + /* expect+1: warning: constant argument to '!' [239] */ + b = !1; b = !(n > 1); return b; Index: src/tests/usr.bin/xlint/lint1/msg_277.c diff -u src/tests/usr.bin/xlint/lint1/msg_277.c:1.5 src/tests/usr.bin/xlint/lint1/msg_277.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_277.c:1.5 Mon Aug 16 20:11:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_277.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_277.c,v 1.5 2021/08/16 20:11:03 rillig Exp $ */ +/* $NetBSD: msg_277.c,v 1.6 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_277.c" // Test for message: initialization of '%s' with '%s' [277] @@ -16,8 +16,10 @@ void example(enum E e, int i) { enum E e2 = e; - enum E e3 = { i }; /* expect: 277 */ - int i2 = { e }; /* expect: 277 */ + /* expect+1: warning: initialization of 'enum E' with 'int' [277] */ + enum E e3 = { i }; + /* expect+1: warning: initialization of 'int' with 'enum E' [277] */ + int i2 = { e }; int i3 = i; sink_enum(e2); Index: src/tests/usr.bin/xlint/lint1/msg_216.c diff -u src/tests/usr.bin/xlint/lint1/msg_216.c:1.3 src/tests/usr.bin/xlint/lint1/msg_216.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_216.c:1.3 Sun Apr 24 20:08:23 2022 +++ src/tests/usr.bin/xlint/lint1/msg_216.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_216.c,v 1.3 2022/04/24 20:08:23 rillig Exp $ */ +/* $NetBSD: msg_216.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_216.c" // Test for message: function %s has return (e); and return; [216] @@ -10,4 +10,5 @@ random(int n) return -3; if (n < 2) return; -} /* expect: 216 */ +} +/* expect-1: warning: function random has return (e); and return; [216] */ Index: src/tests/usr.bin/xlint/lint1/msg_221.exp diff -u src/tests/usr.bin/xlint/lint1/msg_221.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_221.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_221.exp:1.3 Mon Feb 22 15:09:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_221.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_221.c(10): warning: initialization of unsigned with negative constant [221] +msg_221.c(11): warning: initialization of unsigned with negative constant [221] Index: src/tests/usr.bin/xlint/lint1/msg_224.c diff -u src/tests/usr.bin/xlint/lint1/msg_224.c:1.3 src/tests/usr.bin/xlint/lint1/msg_224.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_224.c:1.3 Mon Apr 5 01:35:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_224.c Thu Jun 16 21:24:41 2022 @@ -1,11 +1,17 @@ -/* $NetBSD: msg_224.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */ +/* $NetBSD: msg_224.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_224.c" // Test for message: cannot recover from previous errors [224] -void example1(void) { "syntax" error; } /* expect: 249 */ -void example2(void) { "syntax" error; } /* expect: 249 */ -void example3(void) { "syntax" error; } /* expect: 249 */ -void example4(void) { "syntax" error; } /* expect: 249 */ -void example5(void) { "syntax" error; } /* expect: 249 *//* expect: 224 */ +/* expect+1: error: syntax error 'error' [249] */ +void example1(void) { "syntax" error; } +/* expect+1: error: syntax error 'error' [249] */ +void example2(void) { "syntax" error; } +/* expect+1: error: syntax error 'error' [249] */ +void example3(void) { "syntax" error; } +/* expect+1: error: syntax error 'error' [249] */ +void example4(void) { "syntax" error; } +/* expect+2: error: syntax error 'error' [249] */ +/* expect+1: error: cannot recover from previous errors [224] */ +void example5(void) { "syntax" error; } void example6(void) { "syntax" error; } Index: src/tests/usr.bin/xlint/lint1/msg_224.exp diff -u src/tests/usr.bin/xlint/lint1/msg_224.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_224.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_224.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_224.exp Thu Jun 16 21:24:41 2022 @@ -1,6 +1,6 @@ -msg_224.c(6): error: syntax error 'error' [249] msg_224.c(7): error: syntax error 'error' [249] -msg_224.c(8): error: syntax error 'error' [249] msg_224.c(9): error: syntax error 'error' [249] -msg_224.c(10): error: syntax error 'error' [249] -msg_224.c(10): error: cannot recover from previous errors [224] +msg_224.c(11): error: syntax error 'error' [249] +msg_224.c(13): error: syntax error 'error' [249] +msg_224.c(16): error: syntax error 'error' [249] +msg_224.c(16): error: cannot recover from previous errors [224] Index: src/tests/usr.bin/xlint/lint1/msg_225.exp diff -u src/tests/usr.bin/xlint/lint1/msg_225.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_225.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_225.exp:1.3 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_225.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_225.c(13): error: static function called but not defined: undefined() [225] +msg_225.c(14): error: static function called but not defined: undefined() [225] Index: src/tests/usr.bin/xlint/lint1/msg_229.exp diff -u src/tests/usr.bin/xlint/lint1/msg_229.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_229.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_229.exp:1.3 Sun Feb 28 01:06:57 2021 +++ src/tests/usr.bin/xlint/lint1/msg_229.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_229.c(11): warning: converting 'pointer to function(double) returning double' to 'pointer to int' is questionable [229] -msg_229.c(17): warning: converting 'pointer to int' to 'pointer to function(double) returning double' is questionable [229] +msg_229.c(12): warning: converting 'pointer to function(double) returning double' to 'pointer to int' is questionable [229] +msg_229.c(19): warning: converting 'pointer to int' to 'pointer to function(double) returning double' is questionable [229] Index: src/tests/usr.bin/xlint/lint1/msg_231.c diff -u src/tests/usr.bin/xlint/lint1/msg_231.c:1.3 src/tests/usr.bin/xlint/lint1/msg_231.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_231.c:1.3 Fri Apr 9 20:12:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_231.c Thu Jun 16 21:24:41 2022 @@ -1,10 +1,12 @@ -/* $NetBSD: msg_231.c,v 1.3 2021/04/09 20:12:01 rillig Exp $ */ +/* $NetBSD: msg_231.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_231.c" // Test for message: argument '%s' unused in function '%s' [231] +/* expect+2: warning: argument 'param' unused in function 'example' [231] */ void -example(int param) /* expect: 231 */ +example(int param) { - int local; /* expect: 192 */ + /* expect+1: warning: 'local' unused in function 'example' [192] */ + int local; } Index: src/tests/usr.bin/xlint/lint1/msg_231.exp diff -u src/tests/usr.bin/xlint/lint1/msg_231.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_231.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_231.exp:1.3 Fri Apr 9 20:12:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_231.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_231.c(9): warning: 'local' unused in function 'example' [192] -msg_231.c(7): warning: argument 'param' unused in function 'example' [231] +msg_231.c(11): warning: 'local' unused in function 'example' [192] +msg_231.c(8): warning: argument 'param' unused in function 'example' [231] Index: src/tests/usr.bin/xlint/lint1/msg_238.exp diff -u src/tests/usr.bin/xlint/lint1/msg_238.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_238.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_238.exp:1.3 Mon Mar 29 22:24:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_238.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_238.c(16): warning: initialization of union is illegal in traditional C [238] +msg_238.c(17): warning: initialization of union is illegal in traditional C [238] Index: src/tests/usr.bin/xlint/lint1/msg_262.c diff -u src/tests/usr.bin/xlint/lint1/msg_262.c:1.3 src/tests/usr.bin/xlint/lint1/msg_262.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_262.c:1.3 Tue Jun 29 07:17:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_262.c Thu Jun 16 21:24:41 2022 @@ -1,8 +1,9 @@ -/* $NetBSD: msg_262.c,v 1.3 2021/06/29 07:17:43 rillig Exp $ */ +/* $NetBSD: msg_262.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_262.c" /* Test for message: \" inside character constants undefined in traditional C [262] */ /* lint1-flags: -tw */ -char msg = '\"'; /* expect: [262] */ +/* expect+1: warning: \" inside character constants undefined in traditional C [262] */ +char msg = '\"'; Index: src/tests/usr.bin/xlint/lint1/msg_262.exp diff -u src/tests/usr.bin/xlint/lint1/msg_262.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_262.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_262.exp:1.3 Tue Jun 29 07:17:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_262.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_262.c(8): warning: \" inside character constants undefined in traditional C [262] +msg_262.c(9): warning: \" inside character constants undefined in traditional C [262] Index: src/tests/usr.bin/xlint/lint1/msg_263.c diff -u src/tests/usr.bin/xlint/lint1/msg_263.c:1.3 src/tests/usr.bin/xlint/lint1/msg_263.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_263.c:1.3 Tue Jun 29 07:17:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_263.c Thu Jun 16 21:24:41 2022 @@ -1,8 +1,9 @@ -/* $NetBSD: msg_263.c,v 1.3 2021/06/29 07:17:43 rillig Exp $ */ +/* $NetBSD: msg_263.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_263.c" /* Test for message: \? undefined in traditional C [263] */ /* lint1-flags: -tw */ -char ch = '\?'; /* expect: [263] */ +/* expect+1: warning: \? undefined in traditional C [263] */ +char ch = '\?'; Index: src/tests/usr.bin/xlint/lint1/msg_263.exp diff -u src/tests/usr.bin/xlint/lint1/msg_263.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_263.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_263.exp:1.3 Tue Jun 29 07:17:43 2021 +++ src/tests/usr.bin/xlint/lint1/msg_263.exp Thu Jun 16 21:24:41 2022 @@ -1 +1 @@ -msg_263.c(8): warning: \? undefined in traditional C [263] +msg_263.c(9): warning: \? undefined in traditional C [263] Index: src/tests/usr.bin/xlint/lint1/msg_267.c diff -u src/tests/usr.bin/xlint/lint1/msg_267.c:1.3 src/tests/usr.bin/xlint/lint1/msg_267.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_267.c:1.3 Fri Apr 9 16:37:18 2021 +++ src/tests/usr.bin/xlint/lint1/msg_267.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_267.c,v 1.3 2021/04/09 16:37:18 rillig Exp $ */ +/* $NetBSD: msg_267.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_267.c" // Test for message: shift equal to size of object [267] @@ -6,11 +6,13 @@ int shr32(unsigned int x) { - return x >> 32; /* expect: 267 */ + /* expect+1: warning: shift equal to size of object [267] */ + return x >> 32; } int shl32(unsigned int x) { - return x << 32; /* expect: 267 */ + /* expect+1: warning: shift equal to size of object [267] */ + return x << 32; } Index: src/tests/usr.bin/xlint/lint1/msg_267.exp diff -u src/tests/usr.bin/xlint/lint1/msg_267.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_267.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_267.exp:1.3 Fri Apr 9 16:37:18 2021 +++ src/tests/usr.bin/xlint/lint1/msg_267.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_267.c(9): warning: shift equal to size of object [267] -msg_267.c(15): warning: shift equal to size of object [267] +msg_267.c(10): warning: shift equal to size of object [267] +msg_267.c(17): warning: shift equal to size of object [267] Index: src/tests/usr.bin/xlint/lint1/msg_277.exp diff -u src/tests/usr.bin/xlint/lint1/msg_277.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_277.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_277.exp:1.3 Mon Aug 16 20:11:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_277.exp Thu Jun 16 21:24:41 2022 @@ -1,3 +1,3 @@ -msg_277.c(19): warning: initialization of 'enum E' with 'int' [277] -msg_277.c(20): warning: initialization of 'int' with 'enum E' [277] -msg_277.c(30): warning: initialization of 'enum E' with 'int' [277] +msg_277.c(20): warning: initialization of 'enum E' with 'int' [277] +msg_277.c(22): warning: initialization of 'int' with 'enum E' [277] +msg_277.c(32): warning: initialization of 'enum E' with 'int' [277] Index: src/tests/usr.bin/xlint/lint1/msg_278.c diff -u src/tests/usr.bin/xlint/lint1/msg_278.c:1.3 src/tests/usr.bin/xlint/lint1/msg_278.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_278.c:1.3 Sat Feb 27 18:01:29 2021 +++ src/tests/usr.bin/xlint/lint1/msg_278.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_278.c,v 1.3 2021/02/27 18:01:29 rillig Exp $ */ +/* $NetBSD: msg_278.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_278.c" // Test for message: combination of '%s' and '%s', arg #%d [278] @@ -16,8 +16,10 @@ void example(enum E e, int i) { sink_enum(e); - sink_enum(i); /* expect: 278 */ + /* expect+1: warning: combination of 'enum E' and 'int', arg #1 [278] */ + sink_enum(i); - sink_int(e); /* expect: 278 */ + /* expect+1: warning: combination of 'int' and 'enum E', arg #1 [278] */ + sink_int(e); sink_int(i); } Index: src/tests/usr.bin/xlint/lint1/msg_279.c diff -u src/tests/usr.bin/xlint/lint1/msg_279.c:1.3 src/tests/usr.bin/xlint/lint1/msg_279.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_279.c:1.3 Sat Feb 27 18:01:29 2021 +++ src/tests/usr.bin/xlint/lint1/msg_279.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_279.c,v 1.3 2021/02/27 18:01:29 rillig Exp $ */ +/* $NetBSD: msg_279.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_279.c" // Test for message: combination of '%s' and '%s' in return [279] @@ -15,11 +15,13 @@ void sink_int(int); enum E returning_enum(int i) { - return i; /* expect: 279 */ + /* expect+1: warning: combination of 'enum E' and 'int' in return [279] */ + return i; } int returning_int(enum E e) { - return e; /* expect: 279 */ + /* expect+1: warning: combination of 'int' and 'enum E' in return [279] */ + return e; } Index: src/tests/usr.bin/xlint/lint1/msg_285.c diff -u src/tests/usr.bin/xlint/lint1/msg_285.c:1.3 src/tests/usr.bin/xlint/lint1/msg_285.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_285.c:1.3 Tue Jun 15 08:48:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_285.c Thu Jun 16 21:24:41 2022 @@ -1,15 +1,17 @@ -/* $NetBSD: msg_285.c,v 1.3 2021/06/15 08:48:49 rillig Exp $ */ +/* $NetBSD: msg_285.c,v 1.4 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_285.c" // Test for message: prototype declaration [285] /* lint1-extra-flags: -r */ -void function(int, int, int); /* expect: 285 */ +/* expect+1: prototype declaration [285] */ +void function(int, int, int); /* ARGSUSED */ extern void function(a, b) int a, b; -{ /* expect: 3 declared, 2 defined */ +/* expect+1: error: parameter mismatch: 3 declared, 2 defined [51] */ +{ } Index: src/tests/usr.bin/xlint/lint1/msg_285.exp diff -u src/tests/usr.bin/xlint/lint1/msg_285.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_285.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_285.exp:1.3 Tue Jun 15 08:48:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_285.exp Thu Jun 16 21:24:41 2022 @@ -1,2 +1,2 @@ -msg_285.c(14): error: parameter mismatch: 3 declared, 2 defined [51] -msg_285.c(8): prototype declaration [285] +msg_285.c(16): error: parameter mismatch: 3 declared, 2 defined [51] +msg_285.c(9): prototype declaration [285] Index: src/tests/usr.bin/xlint/lint1/msg_217.c diff -u src/tests/usr.bin/xlint/lint1/msg_217.c:1.9 src/tests/usr.bin/xlint/lint1/msg_217.c:1.10 --- src/tests/usr.bin/xlint/lint1/msg_217.c:1.9 Sun Mar 21 15:24:56 2021 +++ src/tests/usr.bin/xlint/lint1/msg_217.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_217.c,v 1.9 2021/03/21 15:24:56 rillig Exp $ */ +/* $NetBSD: msg_217.c,v 1.10 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_217.c" // Test for message: function %s falls off bottom without returning value [217] @@ -8,7 +8,8 @@ random(int n) { if (n < 0) return -3; -} /* expect: 217 */ +} +/* expect-1: warning: function random falls off bottom without returning value [217] */ /* * The pattern 'do { } while (0)' is often used in statement macros. @@ -62,7 +63,9 @@ unreachable_continue_falls_through(void) { for (;;) { if (0) - continue; /* expect: statement not reached */ + /* expect+1: warning: statement not reached [193] */ + continue; break; } -} /* expect: 217 */ +} +/* expect-1: warning: function unreachable_continue_falls_through falls off bottom without returning value [217] */ Index: src/tests/usr.bin/xlint/lint1/msg_217.exp diff -u src/tests/usr.bin/xlint/lint1/msg_217.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_217.exp:1.9 --- src/tests/usr.bin/xlint/lint1/msg_217.exp:1.8 Sun Mar 21 15:24:56 2021 +++ src/tests/usr.bin/xlint/lint1/msg_217.exp Thu Jun 16 21:24:41 2022 @@ -1,3 +1,3 @@ msg_217.c(11): warning: function random falls off bottom without returning value [217] -msg_217.c(65): warning: statement not reached [193] -msg_217.c(68): warning: function unreachable_continue_falls_through falls off bottom without returning value [217] +msg_217.c(67): warning: statement not reached [193] +msg_217.c(70): warning: function unreachable_continue_falls_through falls off bottom without returning value [217] Index: src/tests/usr.bin/xlint/lint1/msg_249.exp diff -u src/tests/usr.bin/xlint/lint1/msg_249.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_249.exp:1.9 --- src/tests/usr.bin/xlint/lint1/msg_249.exp:1.8 Tue May 31 00:35:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_249.exp Thu Jun 16 21:24:41 2022 @@ -1,9 +1,9 @@ msg_249.c(10): error: syntax error '"' [249] msg_249.c(19): error: syntax error '"' [249] msg_249.c(33): warning: statement not reached [193] -msg_249.c(34): error: syntax error ')' [249] -msg_249.c(59): error: syntax error 'member without type' [249] -msg_249.c(69): warning: label 'unused_label' unused in function 'access_declaration_after_syntax_error' [232] -msg_249.c(72): error: non-constant initializer [177] -msg_249.c(83): warning: label 'unused_label' unused in function 'try_to_recover' [232] -msg_249.c(86): error: non-constant initializer [177] +msg_249.c(35): error: syntax error ')' [249] +msg_249.c(60): error: syntax error 'member without type' [249] +msg_249.c(70): warning: label 'unused_label' unused in function 'access_declaration_after_syntax_error' [232] +msg_249.c(73): error: non-constant initializer [177] +msg_249.c(84): warning: label 'unused_label' unused in function 'try_to_recover' [232] +msg_249.c(87): error: non-constant initializer [177] Index: src/tests/usr.bin/xlint/lint1/msg_220.c diff -u src/tests/usr.bin/xlint/lint1/msg_220.c:1.7 src/tests/usr.bin/xlint/lint1/msg_220.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_220.c:1.7 Sun Aug 29 09:29:32 2021 +++ src/tests/usr.bin/xlint/lint1/msg_220.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_220.c,v 1.7 2021/08/29 09:29:32 rillig Exp $ */ +/* $NetBSD: msg_220.c,v 1.8 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_220.c" // Test for message: fallthrough on case statement [220] @@ -16,10 +16,12 @@ example(int n) case 3: case 5: println("odd"); - case 2: /* expect: 220 */ + /* expect+1: warning: fallthrough on case statement [220] */ + case 2: case 7: println("prime"); - default: /* expect: 284 */ + /* expect+1: warning: fallthrough on default statement [284] */ + default: println("number"); } } Index: src/tests/usr.bin/xlint/lint1/msg_241.c diff -u src/tests/usr.bin/xlint/lint1/msg_241.c:1.7 src/tests/usr.bin/xlint/lint1/msg_241.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_241.c:1.7 Sat Oct 30 22:04:42 2021 +++ src/tests/usr.bin/xlint/lint1/msg_241.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_241.c,v 1.7 2021/10/30 22:04:42 rillig Exp $ */ +/* $NetBSD: msg_241.c,v 1.8 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_241.c" // Test for message: dubious operation on enum, op %s [241] @@ -27,21 +27,36 @@ example(void) { enum color c = RED; - sink_bool(!c); /* expect: 241 */ - sink_color(~c); /* expect: 241 */ - ++c; /* expect: 241 */ - --c; /* expect: 241 */ - c++; /* expect: 241 */ - c--; /* expect: 241 */ - sink_color(+c); /* expect: 241 */ - sink_color(-c); /* expect: 241 */ - sink_color(c * c); /* expect: 241 */ - sink_color(c / c); /* expect: 241 */ - sink_color(c % c); /* expect: 241 */ - sink_color(c + c); /* expect: 241 */ - sink_color(c - c); /* expect: 241 */ - sink_color(c << c); /* expect: 241 */ - sink_color(c >> c); /* expect: 241 */ + /* expect+1: warning: dubious operation on enum, op ! [241] */ + sink_bool(!c); + /* expect+1: warning: dubious operation on enum, op ~ [241] */ + sink_color(~c); + /* expect+1: warning: dubious operation on enum, op ++x [241] */ + ++c; + /* expect+1: warning: dubious operation on enum, op --x [241] */ + --c; + /* expect+1: warning: dubious operation on enum, op x++ [241] */ + c++; + /* expect+1: warning: dubious operation on enum, op x-- [241] */ + c--; + /* expect+1: warning: dubious operation on enum, op + [241] */ + sink_color(+c); + /* expect+1: warning: dubious operation on enum, op - [241] */ + sink_color(-c); + /* expect+1: warning: dubious operation on enum, op * [241] */ + sink_color(c * c); + /* expect+1: warning: dubious operation on enum, op / [241] */ + sink_color(c / c); + /* expect+1: warning: dubious operation on enum, op % [241] */ + sink_color(c % c); + /* expect+1: warning: dubious operation on enum, op + [241] */ + sink_color(c + c); + /* expect+1: warning: dubious operation on enum, op - [241] */ + sink_color(c - c); + /* expect+1: warning: dubious operation on enum, op << [241] */ + sink_color(c << c); + /* expect+1: warning: dubious operation on enum, op >> [241] */ + sink_color(c >> c); sink_bool(c < c); sink_bool(c <= c); @@ -50,28 +65,44 @@ example(void) sink_bool(c == c); sink_bool(c != c); - sink_color(c & c); /* expect: 241 */ - sink_color(c ^ c); /* expect: 241 */ - sink_color(c | c); /* expect: 241 */ - - sink_bool(c && c); /* expect: 241 */ - sink_bool(c || c); /* expect: 241 */ + /* expect+1: warning: dubious operation on enum, op & [241] */ + sink_color(c & c); + /* expect+1: warning: dubious operation on enum, op ^ [241] */ + sink_color(c ^ c); + /* expect+1: warning: dubious operation on enum, op | [241] */ + sink_color(c | c); + + /* expect+1: warning: dubious operation on enum, op && [241] */ + sink_bool(c && c); + /* expect+1: warning: dubious operation on enum, op || [241] */ + sink_bool(c || c); sink_color(c ? c : BLUE); c = GREEN; - c *= c; /* expect: 241 */ - c /= c; /* expect: 241 */ - c %= c; /* expect: 241 */ - c += c; /* expect: 241 */ - c -= c; /* expect: 241 */ - c <<= c; /* expect: 241 */ - c >>= c; /* expect: 241 */ - c &= c; /* expect: 241 */ - c ^= c; /* expect: 241 */ - c |= c; /* expect: 241 */ + /* expect+1: warning: dubious operation on enum, op *= [241] */ + c *= c; + /* expect+1: warning: dubious operation on enum, op /= [241] */ + c /= c; + /* expect+1: warning: dubious operation on enum, op %= [241] */ + c %= c; + /* expect+1: warning: dubious operation on enum, op += [241] */ + c += c; + /* expect+1: warning: dubious operation on enum, op -= [241] */ + c -= c; + /* expect+1: warning: dubious operation on enum, op <<= [241] */ + c <<= c; + /* expect+1: warning: dubious operation on enum, op >>= [241] */ + c >>= c; + /* expect+1: warning: dubious operation on enum, op &= [241] */ + c &= c; + /* expect+1: warning: dubious operation on enum, op ^= [241] */ + c ^= c; + /* expect+1: warning: dubious operation on enum, op |= [241] */ + c |= c; /* The cast to unsigned is required by GCC at WARNS=6. */ - c &= ~(unsigned)GREEN; /* expect: 241 */ + /* expect+1: warning: dubious operation on enum, op &= [241] */ + c &= ~(unsigned)GREEN; } void Index: src/tests/usr.bin/xlint/lint1/msg_221.c diff -u src/tests/usr.bin/xlint/lint1/msg_221.c:1.4 src/tests/usr.bin/xlint/lint1/msg_221.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_221.c:1.4 Mon Feb 22 15:09:50 2021 +++ src/tests/usr.bin/xlint/lint1/msg_221.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_221.c,v 1.4 2021/02/22 15:09:50 rillig Exp $ */ +/* $NetBSD: msg_221.c,v 1.5 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_221.c" // Test for message: initialization of unsigned with negative constant [221] @@ -7,6 +7,7 @@ struct example { unsigned int a: 5; unsigned int b: 5; } example_var = { - -1, /* expect: 221 */ + /* expect+1: warning: initialization of unsigned with negative constant [221] */ + -1, 31 }; Index: src/tests/usr.bin/xlint/lint1/msg_238.c diff -u src/tests/usr.bin/xlint/lint1/msg_238.c:1.4 src/tests/usr.bin/xlint/lint1/msg_238.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_238.c:1.4 Mon Mar 29 22:24:34 2021 +++ src/tests/usr.bin/xlint/lint1/msg_238.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_238.c,v 1.4 2021/03/29 22:24:34 rillig Exp $ */ +/* $NetBSD: msg_238.c,v 1.5 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_238.c" /* Test for message: initialization of union is illegal in traditional C [238] */ @@ -13,6 +13,7 @@ struct { union { int x; -} u = { /* expect: 238 */ +/* expect+1: warning: initialization of union is illegal in traditional C [238] */ +} u = { 3 }; Index: src/tests/usr.bin/xlint/lint1/msg_239.exp diff -u src/tests/usr.bin/xlint/lint1/msg_239.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_239.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_239.exp:1.4 Fri Apr 2 22:41:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_239.exp Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -msg_239.c(13): warning: constant in conditional context [161] -msg_239.c(13): warning: constant argument to '!' [239] -msg_239.c(14): warning: constant in conditional context [161] -msg_239.c(14): warning: constant argument to '!' [239] +msg_239.c(15): warning: constant in conditional context [161] +msg_239.c(15): warning: constant argument to '!' [239] +msg_239.c(18): warning: constant in conditional context [161] +msg_239.c(18): warning: constant argument to '!' [239] Index: src/tests/usr.bin/xlint/lint1/msg_241.exp diff -u src/tests/usr.bin/xlint/lint1/msg_241.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_241.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_241.exp:1.4 Mon Aug 16 18:51:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_241.exp Thu Jun 16 21:24:41 2022 @@ -1,33 +1,33 @@ -msg_241.c(30): warning: dubious operation on enum, op ! [241] -msg_241.c(31): warning: dubious operation on enum, op ~ [241] -msg_241.c(32): warning: dubious operation on enum, op ++x [241] -msg_241.c(33): warning: dubious operation on enum, op --x [241] -msg_241.c(34): warning: dubious operation on enum, op x++ [241] -msg_241.c(35): warning: dubious operation on enum, op x-- [241] -msg_241.c(36): warning: dubious operation on enum, op + [241] -msg_241.c(37): warning: dubious operation on enum, op - [241] -msg_241.c(38): warning: dubious operation on enum, op * [241] -msg_241.c(39): warning: dubious operation on enum, op / [241] -msg_241.c(40): warning: dubious operation on enum, op % [241] -msg_241.c(41): warning: dubious operation on enum, op + [241] -msg_241.c(42): warning: dubious operation on enum, op - [241] -msg_241.c(43): warning: dubious operation on enum, op << [241] -msg_241.c(44): warning: dubious operation on enum, op >> [241] -msg_241.c(53): warning: dubious operation on enum, op & [241] -msg_241.c(54): warning: dubious operation on enum, op ^ [241] -msg_241.c(55): warning: dubious operation on enum, op | [241] -msg_241.c(57): warning: dubious operation on enum, op && [241] -msg_241.c(58): warning: dubious operation on enum, op || [241] -msg_241.c(62): warning: dubious operation on enum, op *= [241] -msg_241.c(63): warning: dubious operation on enum, op /= [241] -msg_241.c(64): warning: dubious operation on enum, op %= [241] -msg_241.c(65): warning: dubious operation on enum, op += [241] -msg_241.c(66): warning: dubious operation on enum, op -= [241] -msg_241.c(67): warning: dubious operation on enum, op <<= [241] -msg_241.c(68): warning: dubious operation on enum, op >>= [241] -msg_241.c(69): warning: dubious operation on enum, op &= [241] -msg_241.c(70): warning: dubious operation on enum, op ^= [241] -msg_241.c(71): warning: dubious operation on enum, op |= [241] -msg_241.c(74): warning: dubious operation on enum, op &= [241] -msg_241.c(82): warning: dubious operation on enum, op * [241] -msg_241.c(82): warning: combination of 'enum color' and 'int', op > [242] +msg_241.c(31): warning: dubious operation on enum, op ! [241] +msg_241.c(33): warning: dubious operation on enum, op ~ [241] +msg_241.c(35): warning: dubious operation on enum, op ++x [241] +msg_241.c(37): warning: dubious operation on enum, op --x [241] +msg_241.c(39): warning: dubious operation on enum, op x++ [241] +msg_241.c(41): warning: dubious operation on enum, op x-- [241] +msg_241.c(43): warning: dubious operation on enum, op + [241] +msg_241.c(45): warning: dubious operation on enum, op - [241] +msg_241.c(47): warning: dubious operation on enum, op * [241] +msg_241.c(49): warning: dubious operation on enum, op / [241] +msg_241.c(51): warning: dubious operation on enum, op % [241] +msg_241.c(53): warning: dubious operation on enum, op + [241] +msg_241.c(55): warning: dubious operation on enum, op - [241] +msg_241.c(57): warning: dubious operation on enum, op << [241] +msg_241.c(59): warning: dubious operation on enum, op >> [241] +msg_241.c(69): warning: dubious operation on enum, op & [241] +msg_241.c(71): warning: dubious operation on enum, op ^ [241] +msg_241.c(73): warning: dubious operation on enum, op | [241] +msg_241.c(76): warning: dubious operation on enum, op && [241] +msg_241.c(78): warning: dubious operation on enum, op || [241] +msg_241.c(83): warning: dubious operation on enum, op *= [241] +msg_241.c(85): warning: dubious operation on enum, op /= [241] +msg_241.c(87): warning: dubious operation on enum, op %= [241] +msg_241.c(89): warning: dubious operation on enum, op += [241] +msg_241.c(91): warning: dubious operation on enum, op -= [241] +msg_241.c(93): warning: dubious operation on enum, op <<= [241] +msg_241.c(95): warning: dubious operation on enum, op >>= [241] +msg_241.c(97): warning: dubious operation on enum, op &= [241] +msg_241.c(99): warning: dubious operation on enum, op ^= [241] +msg_241.c(101): warning: dubious operation on enum, op |= [241] +msg_241.c(105): warning: dubious operation on enum, op &= [241] +msg_241.c(113): warning: dubious operation on enum, op * [241] +msg_241.c(113): warning: combination of 'enum color' and 'int', op > [242] Index: src/tests/usr.bin/xlint/lint1/msg_245.c diff -u src/tests/usr.bin/xlint/lint1/msg_245.c:1.4 src/tests/usr.bin/xlint/lint1/msg_245.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_245.c:1.4 Sun Feb 28 02:00:06 2021 +++ src/tests/usr.bin/xlint/lint1/msg_245.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_245.c,v 1.4 2021/02/28 02:00:06 rillig Exp $ */ +/* $NetBSD: msg_245.c,v 1.5 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_245.c" // Test for message: incompatible structure pointers: '%s' '%s' '%s' [245] @@ -26,7 +26,10 @@ example(tag_and_typedef_typedef both, only_typedef only_typedef, struct only_tag only_tag) { - sink_bool(&both == &only_tag); /* expect: 245 */ - sink_bool(&both == &only_typedef); /* expect: 245 */ - sink_bool(&both == &unnamed); /* expect: 245 */ + /* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct only_tag' [245] */ + sink_bool(&both == &only_tag); + /* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct typedef only_typedef' [245] */ + sink_bool(&both == &only_typedef); + /* expect+1: warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct <unnamed>' [245] */ + sink_bool(&both == &unnamed); } Index: src/tests/usr.bin/xlint/lint1/msg_245.exp diff -u src/tests/usr.bin/xlint/lint1/msg_245.exp:1.4 src/tests/usr.bin/xlint/lint1/msg_245.exp:1.5 --- src/tests/usr.bin/xlint/lint1/msg_245.exp:1.4 Sun Feb 28 02:29:28 2021 +++ src/tests/usr.bin/xlint/lint1/msg_245.exp Thu Jun 16 21:24:41 2022 @@ -1,3 +1,3 @@ -msg_245.c(29): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct only_tag' [245] -msg_245.c(30): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct typedef only_typedef' [245] -msg_245.c(31): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct <unnamed>' [245] +msg_245.c(30): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct only_tag' [245] +msg_245.c(32): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct typedef only_typedef' [245] +msg_245.c(34): warning: incompatible structure pointers: 'pointer to struct tag_and_typedef_tag' '==' 'pointer to struct <unnamed>' [245] Index: src/tests/usr.bin/xlint/lint1/msg_275.c diff -u src/tests/usr.bin/xlint/lint1/msg_275.c:1.4 src/tests/usr.bin/xlint/lint1/msg_275.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_275.c:1.4 Sun Feb 28 12:40:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_275.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_275.c,v 1.4 2021/02/28 12:40:00 rillig Exp $ */ +/* $NetBSD: msg_275.c,v 1.5 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_275.c" // Test for message: cast discards 'const' from type '%s' [275] @@ -8,7 +8,8 @@ char * unconst_string(const char *s) { - return (char *)s; /* expect: 275 */ + /* expect+1: warning: cast discards 'const' from type 'pointer to const char' [275] */ + return (char *)s; } const char * Index: src/tests/usr.bin/xlint/lint1/msg_247.c diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.17 src/tests/usr.bin/xlint/lint1/msg_247.c:1.18 --- src/tests/usr.bin/xlint/lint1/msg_247.c:1.17 Sat Jun 11 11:52:13 2022 +++ src/tests/usr.bin/xlint/lint1/msg_247.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_247.c,v 1.17 2022/06/11 11:52:13 rillig Exp $ */ +/* $NetBSD: msg_247.c,v 1.18 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_247.c" // Test for message: pointer cast from '%s' to '%s' may be troublesome [247] @@ -28,7 +28,8 @@ example(struct Other *arg) * with no hint at all that there is a typedef for a pointer to the * struct. */ - display = (PDisplay)arg; /* expect: 247 */ + /* expect+1: warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247] */ + display = (PDisplay)arg; } /* @@ -67,7 +68,8 @@ cast_to_unsigned_char_pointer(struct Oth signed char * cast_to_signed_char_pointer(struct Other *arg) { - return (signed char *)arg; /* expect: 247 */ + /* expect+1: warning: pointer cast from 'pointer to struct Other' to 'pointer to signed char' may be troublesome [247] */ + return (signed char *)arg; } char * @@ -154,7 +156,7 @@ lh_OPENSSL_STRING_new(void) */ return (struct lhash_st_OPENSSL_STRING *)OPENSSL_LH_new(); } -# 158 "msg_247.c" 2 +# 160 "msg_247.c" 2 void sink(const void *); Index: src/tests/usr.bin/xlint/lint1/msg_247.exp diff -u src/tests/usr.bin/xlint/lint1/msg_247.exp:1.13 src/tests/usr.bin/xlint/lint1/msg_247.exp:1.14 --- src/tests/usr.bin/xlint/lint1/msg_247.exp:1.13 Sat Jun 11 11:52:13 2022 +++ src/tests/usr.bin/xlint/lint1/msg_247.exp Thu Jun 16 21:24:41 2022 @@ -1,3 +1,3 @@ -msg_247.c(31): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247] -msg_247.c(70): warning: pointer cast from 'pointer to struct Other' to 'pointer to signed char' may be troublesome [247] -msg_247.c(135): warning: struct 'lhash_st' never defined [233] +msg_247.c(32): warning: pointer cast from 'pointer to struct Other' to 'pointer to struct <unnamed>' may be troublesome [247] +msg_247.c(72): warning: pointer cast from 'pointer to struct Other' to 'pointer to signed char' may be troublesome [247] +msg_247.c(137): warning: struct 'lhash_st' never defined [233] Index: src/tests/usr.bin/xlint/lint1/msg_249.c diff -u src/tests/usr.bin/xlint/lint1/msg_249.c:1.10 src/tests/usr.bin/xlint/lint1/msg_249.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_249.c:1.10 Tue May 31 00:35:18 2022 +++ src/tests/usr.bin/xlint/lint1/msg_249.c Thu Jun 16 21:24:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_249.c,v 1.10 2022/05/31 00:35:18 rillig Exp $ */ +/* $NetBSD: msg_249.c,v 1.11 2022/06/16 21:24:41 rillig Exp $ */ # 3 "msg_249.c" // Test for message: syntax error '%s' [249] @@ -31,7 +31,8 @@ function(void) /* expect+2: warning: statement not reached [193] */ if (0) ; - ); /* expect: syntax error ')' */ + /* expect+1: error: syntax error ')' [249] */ + ); } /* XXX: It is unexpected that this error is not detected. */