Module Name: src Committed By: rillig Date: Thu Jul 8 05:18:49 UTC 2021
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile msg_002.c msg_002.exp msg_072.c msg_072.exp Added Files: src/tests/usr.bin/xlint/lint1: msg_000_c90.c msg_000_c90.exp msg_001_c90.c msg_001_c90.exp msg_272_c90.c msg_272_c90.exp Log Message: tests/lint: add tests for C90 mode and malformed declarations In the grammar, 148 lines are still uncovered by the tests. The untested parts are mostly obscure declarations and a few parse errors. To generate a diff of this commit: cvs rdiff -u -r1.1077 -r1.1078 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.80 -r1.81 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_000_c90.c \ src/tests/usr.bin/xlint/lint1/msg_000_c90.exp \ src/tests/usr.bin/xlint/lint1/msg_001_c90.c \ src/tests/usr.bin/xlint/lint1/msg_001_c90.exp \ src/tests/usr.bin/xlint/lint1/msg_272_c90.c \ src/tests/usr.bin/xlint/lint1/msg_272_c90.exp cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_002.c \ src/tests/usr.bin/xlint/lint1/msg_072.c cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_002.exp \ src/tests/usr.bin/xlint/lint1/msg_072.exp 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.1077 src/distrib/sets/lists/tests/mi:1.1078 --- src/distrib/sets/lists/tests/mi:1.1077 Tue Jul 6 17:33:07 2021 +++ src/distrib/sets/lists/tests/mi Thu Jul 8 05:18:49 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1077 2021/07/06 17:33:07 rillig Exp $ +# $NetBSD: mi,v 1.1078 2021/07/08 05:18:49 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6257,8 +6257,12 @@ ./usr/tests/usr.bin/xlint/lint1/lex_wide_string.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_000.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_000.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_000_c90.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_000_c90.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_001.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_001.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_001_c90.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_001_c90.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_002.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_002.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_003.c tests-usr.bin-tests compattestfile,atf @@ -6805,6 +6809,8 @@ ./usr/tests/usr.bin/xlint/lint1/msg_271.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_272.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_272.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_272_c90.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_272_c90.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_273.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_273.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_274.c tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.80 src/tests/usr.bin/xlint/lint1/Makefile:1.81 --- src/tests/usr.bin/xlint/lint1/Makefile:1.80 Tue Jul 6 17:33:07 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Thu Jul 8 05:18:49 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.80 2021/07/06 17:33:07 rillig Exp $ +# $NetBSD: Makefile,v 1.81 2021/07/08 05:18:49 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 345 # see lint1/err.c @@ -157,10 +157,16 @@ FILES+= lex_wide_char.exp FILES+= lex_wide_string.c FILES+= lex_wide_string.exp FILES+= ${:U0 ${:U:${:Urange=${MAX_MESSAGE}}}:C,^.$,0&,:C,^..$,0&,:@i@msg_${i}.c msg_${i}.exp@:Nmsg_176.exp} +FILES+= msg_001_c90.c +FILES+= msg_001_c90.exp +FILES+= msg_000_c90.c +FILES+= msg_000_c90.exp FILES+= msg_230_uchar.c FILES+= msg_230_uchar.exp FILES+= msg_259_ilp32.c FILES+= msg_259_ilp32.exp +FILES+= msg_272_c90.c +FILES+= msg_272_c90.exp FILES+= op_colon.c FILES+= op_colon.exp FILES+= op_shl_lp64.c Index: src/tests/usr.bin/xlint/lint1/msg_002.c diff -u src/tests/usr.bin/xlint/lint1/msg_002.c:1.3 src/tests/usr.bin/xlint/lint1/msg_002.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_002.c:1.3 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_002.c Thu Jul 8 05:18:49 2021 @@ -1,8 +1,12 @@ -/* $NetBSD: msg_002.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_002.c,v 1.4 2021/07/08 05:18:49 rillig Exp $ */ # 3 "msg_002.c" // Test for message: empty declaration [2] -int; /* expect: 2 */ +/* expect+1: warning: empty declaration [2] */ +int; int local_variable; + +/* expect+1: warning: empty declaration [2] */ +const; Index: src/tests/usr.bin/xlint/lint1/msg_072.c diff -u src/tests/usr.bin/xlint/lint1/msg_072.c:1.3 src/tests/usr.bin/xlint/lint1/msg_072.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_072.c:1.3 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_072.c Thu Jul 8 05:18:49 2021 @@ -1,8 +1,12 @@ -/* $NetBSD: msg_072.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_072.c,v 1.4 2021/07/08 05:18:49 rillig Exp $ */ # 3 "msg_072.c" // Test for message: typedef declares no type name [72] -typedef int; /* expect: 72 */ +/* expect+1: warning: typedef declares no type name [72] */ +typedef int; typedef int number; + +/* expect+1: warning: typedef declares no type name [72] */ +const typedef; Index: src/tests/usr.bin/xlint/lint1/msg_002.exp diff -u src/tests/usr.bin/xlint/lint1/msg_002.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_002.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_002.exp:1.2 Sat Jan 2 18:06:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_002.exp Thu Jul 8 05:18:49 2021 @@ -1 +1,2 @@ -msg_002.c(6): warning: empty declaration [2] +msg_002.c(7): warning: empty declaration [2] +msg_002.c(12): warning: empty declaration [2] Index: src/tests/usr.bin/xlint/lint1/msg_072.exp diff -u src/tests/usr.bin/xlint/lint1/msg_072.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_072.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_072.exp:1.2 Sun Jan 3 15:35:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_072.exp Thu Jul 8 05:18:49 2021 @@ -1 +1,2 @@ -msg_072.c(6): warning: typedef declares no type name [72] +msg_072.c(7): warning: typedef declares no type name [72] +msg_072.c(12): warning: typedef declares no type name [72] Added files: Index: src/tests/usr.bin/xlint/lint1/msg_000_c90.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_000_c90.c:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_000_c90.c Thu Jul 8 05:18:49 2021 @@ -0,0 +1,13 @@ +/* $NetBSD: msg_000_c90.c,v 1.1 2021/07/08 05:18:49 rillig Exp $ */ +# 3 "msg_000_c90.c" + +/* + * Test for message: empty declaration [0] + * + * In strict C90 mode, an empty declaration is an error, not merely a warning. + */ + +/* lint1-flags: -s */ + +/* expect+1: error: empty declaration [0] */ +; Index: src/tests/usr.bin/xlint/lint1/msg_000_c90.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_000_c90.exp:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_000_c90.exp Thu Jul 8 05:18:49 2021 @@ -0,0 +1 @@ +msg_000_c90.c(13): error: empty declaration [0] Index: src/tests/usr.bin/xlint/lint1/msg_001_c90.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_001_c90.c:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_001_c90.c Thu Jul 8 05:18:49 2021 @@ -0,0 +1,14 @@ +/* $NetBSD: msg_001_c90.c,v 1.1 2021/07/08 05:18:49 rillig Exp $ */ +# 3 "msg_001_c90.c" + +/* + * Test for message: old style declaration; add 'int' [1] + * + * In strict C90 mode, an old-style declaration is an error, not merely a + * warning. + */ + +/* lint1-flags: -s */ + +/* expect+1: error: old style declaration; add 'int' [1] */ +implicit_global_variable; Index: src/tests/usr.bin/xlint/lint1/msg_001_c90.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_001_c90.exp:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_001_c90.exp Thu Jul 8 05:18:49 2021 @@ -0,0 +1 @@ +msg_001_c90.c(14): error: old style declaration; add 'int' [1] Index: src/tests/usr.bin/xlint/lint1/msg_272_c90.c diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_272_c90.c:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_272_c90.c Thu Jul 8 05:18:49 2021 @@ -0,0 +1,13 @@ +/* $NetBSD: msg_272_c90.c,v 1.1 2021/07/08 05:18:49 rillig Exp $ */ +# 3 "msg_272_c90.c" + +/* + * Test for message: empty translation unit [272] + * + * In strict C90 mode, an empty translation unit is an error, not merely a + * warning. + */ + +/* lint1-flags: -s */ + +/* expect+1: error: empty translation unit [272] */ Index: src/tests/usr.bin/xlint/lint1/msg_272_c90.exp diff -u /dev/null src/tests/usr.bin/xlint/lint1/msg_272_c90.exp:1.1 --- /dev/null Thu Jul 8 05:18:49 2021 +++ src/tests/usr.bin/xlint/lint1/msg_272_c90.exp Thu Jul 8 05:18:49 2021 @@ -0,0 +1 @@ +msg_272_c90.c(14): error: empty translation unit [272]