Module Name: src Committed By: rillig Date: Tue Apr 5 23:09:19 UTC 2022
Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile msg_018.c msg_018.exp msg_022.c msg_022.exp msg_026.c msg_026.exp msg_027.c msg_027.exp msg_028.c msg_028.exp msg_030.c msg_030.exp msg_032.c msg_032.exp msg_039.c msg_039.exp msg_040.c Removed Files: src/tests/usr.bin/xlint/lint1: msg_040.exp Log Message: tests/lint: add tests for a few early messages To generate a diff of this commit: cvs rdiff -u -r1.1189 -r1.1190 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.117 -r1.118 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_018.c \ src/tests/usr.bin/xlint/lint1/msg_018.exp \ src/tests/usr.bin/xlint/lint1/msg_022.c \ src/tests/usr.bin/xlint/lint1/msg_022.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_026.c \ src/tests/usr.bin/xlint/lint1/msg_026.exp \ src/tests/usr.bin/xlint/lint1/msg_028.c \ src/tests/usr.bin/xlint/lint1/msg_028.exp \ src/tests/usr.bin/xlint/lint1/msg_030.c \ src/tests/usr.bin/xlint/lint1/msg_030.exp \ src/tests/usr.bin/xlint/lint1/msg_032.c \ src/tests/usr.bin/xlint/lint1/msg_032.exp \ src/tests/usr.bin/xlint/lint1/msg_039.c \ src/tests/usr.bin/xlint/lint1/msg_039.exp \ src/tests/usr.bin/xlint/lint1/msg_040.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_027.c \ src/tests/usr.bin/xlint/lint1/msg_027.exp cvs rdiff -u -r1.2 -r0 src/tests/usr.bin/xlint/lint1/msg_040.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.1189 src/distrib/sets/lists/tests/mi:1.1190 --- src/distrib/sets/lists/tests/mi:1.1189 Mon Mar 28 20:52:17 2022 +++ src/distrib/sets/lists/tests/mi Tue Apr 5 23:09:19 2022 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1189 2022/03/28 20:52:17 christos Exp $ +# $NetBSD: mi,v 1.1190 2022/04/05 23:09:19 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6626,7 +6626,7 @@ ./usr/tests/usr.bin/xlint/lint1/msg_039.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_039.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_040.c tests-usr.bin-tests compattestfile,atf -./usr/tests/usr.bin/xlint/lint1/msg_040.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_040.exp tests-obsolete obsolete,atf ./usr/tests/usr.bin/xlint/lint1/msg_041.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_041.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_042.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.117 src/tests/usr.bin/xlint/lint1/Makefile:1.118 --- src/tests/usr.bin/xlint/lint1/Makefile:1.117 Mon Dec 20 19:48:05 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Tue Apr 5 23:09:19 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.117 2021/12/20 19:48:05 rillig Exp $ +# $NetBSD: Makefile,v 1.118 2022/04/05 23:09:19 rillig Exp $ NOMAN= # defined MAX_MESSAGE= 348 # see lint1/err.c @@ -216,7 +216,7 @@ FILES+= lex_wide_char.c 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+= ${:U0 ${:U:${:Urange=${MAX_MESSAGE}}}:C,^.$,0&,:C,^..$,0&,:@i@msg_${i}.c msg_${i}.exp@:Nmsg_040.exp:Nmsg_176.exp} FILES+= msg_001_c90.c FILES+= msg_001_c90.exp FILES+= msg_000_c90.c Index: src/tests/usr.bin/xlint/lint1/msg_018.c diff -u src/tests/usr.bin/xlint/lint1/msg_018.c:1.3 src/tests/usr.bin/xlint/lint1/msg_018.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_018.c:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_018.c Tue Apr 5 23:09:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_018.c,v 1.3 2021/08/26 19:23:25 rillig Exp $ */ +/* $NetBSD: msg_018.c,v 1.4 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_018.c" // Test for message: illegal use of 'void' [18] @@ -9,5 +9,6 @@ void x; /* expect+1: error: cannot take size/alignment of void [146] */ unsigned long sizeof_void = sizeof(void); -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+2: error: illegal use of 'void' [18] */ +/* expect+1: warning: empty array declaration: void_array [190] */ +void void_array[]; Index: src/tests/usr.bin/xlint/lint1/msg_018.exp diff -u src/tests/usr.bin/xlint/lint1/msg_018.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_018.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_018.exp:1.3 Thu Aug 26 19:23:25 2021 +++ src/tests/usr.bin/xlint/lint1/msg_018.exp Tue Apr 5 23:09:19 2022 @@ -1,3 +1,4 @@ msg_018.c(7): error: void type for 'x' [19] msg_018.c(10): error: cannot take size/alignment of void [146] -msg_018.c(12): error: syntax error ':' [249] +msg_018.c(14): error: illegal use of 'void' [18] +msg_018.c(14): warning: empty array declaration: void_array [190] Index: src/tests/usr.bin/xlint/lint1/msg_022.c diff -u src/tests/usr.bin/xlint/lint1/msg_022.c:1.3 src/tests/usr.bin/xlint/lint1/msg_022.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_022.c:1.3 Sat Apr 2 20:12:46 2022 +++ src/tests/usr.bin/xlint/lint1/msg_022.c Tue Apr 5 23:09:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_022.c,v 1.3 2022/04/02 20:12:46 rillig Exp $ */ +/* $NetBSD: msg_022.c,v 1.4 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_022.c" // Test for message: incomplete or misplaced function definition [22] @@ -25,6 +25,6 @@ unsigned long sz = sizeof(int(param1, pa /* expect+1: warning: empty declaration [0] */ ; -/* 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." +/* expect+2: error: incomplete or misplaced function definition [22] */ +/* expect+1: warning: old style declaration; add 'int' [1] */ +old_style(arg); Index: src/tests/usr.bin/xlint/lint1/msg_022.exp diff -u src/tests/usr.bin/xlint/lint1/msg_022.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_022.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_022.exp:1.3 Sat Apr 2 20:12:46 2022 +++ src/tests/usr.bin/xlint/lint1/msg_022.exp Tue Apr 5 23:09:19 2022 @@ -2,4 +2,5 @@ msg_022.c(11): error: syntax error 'f' [ msg_022.c(15): warning: empty declaration [0] msg_022.c(22): error: syntax error 'param1' [249] msg_022.c(26): warning: empty declaration [0] -msg_022.c(29): error: syntax error ':' [249] +msg_022.c(30): error: incomplete or misplaced function definition [22] +msg_022.c(30): warning: old style declaration; add 'int' [1] Index: src/tests/usr.bin/xlint/lint1/msg_026.c diff -u src/tests/usr.bin/xlint/lint1/msg_026.c:1.2 src/tests/usr.bin/xlint/lint1/msg_026.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_026.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_026.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,8 @@ -/* $NetBSD: msg_026.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_026.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_026.c" // Test for message: cannot initialize extern declaration: %s [26] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* expect+1: warning: cannot initialize extern declaration: used [26] */ +extern int used = 1; +int defined = 1; Index: src/tests/usr.bin/xlint/lint1/msg_026.exp diff -u src/tests/usr.bin/xlint/lint1/msg_026.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_026.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_026.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_026.exp Tue Apr 5 23:09:19 2022 @@ -1 +1 @@ -msg_026.c(6): error: syntax error ':' [249] +msg_026.c(7): warning: cannot initialize extern declaration: used [26] Index: src/tests/usr.bin/xlint/lint1/msg_028.c diff -u src/tests/usr.bin/xlint/lint1/msg_028.c:1.2 src/tests/usr.bin/xlint/lint1/msg_028.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_028.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_028.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,17 @@ -/* $NetBSD: msg_028.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_028.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_028.c" // Test for message: redefinition of %s [28] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +int +defined(int arg) +{ + return arg; +} + +int +defined(int arg) +/* expect+1: error: redefinition of defined [28] */ +{ + return arg; +} Index: src/tests/usr.bin/xlint/lint1/msg_028.exp diff -u src/tests/usr.bin/xlint/lint1/msg_028.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_028.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_028.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_028.exp Tue Apr 5 23:09:19 2022 @@ -1 +1 @@ -msg_028.c(6): error: syntax error ':' [249] +msg_028.c(15): error: redefinition of defined [28] Index: src/tests/usr.bin/xlint/lint1/msg_030.c diff -u src/tests/usr.bin/xlint/lint1/msg_030.c:1.2 src/tests/usr.bin/xlint/lint1/msg_030.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_030.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_030.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,24 @@ -/* $NetBSD: msg_030.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_030.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_030.c" -// Test for message: redeclaration of %s; ANSI C requires static [30] +/* Test for message: redeclaration of %s; ANSI C requires static [30] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -sw */ + +static a; +/* expect+1: warning: redeclaration of a; ANSI C requires static [30] */ +int a; + +static b; +/* expect+1: warning: redeclaration of b; ANSI C requires static [30] */ +int b = 1; + +static c = 1; +/* expect+1: warning: redeclaration of c; ANSI C requires static [30] */ +int c; + +void +use_variables(void) +{ + c = a + b + c; +} Index: src/tests/usr.bin/xlint/lint1/msg_030.exp diff -u src/tests/usr.bin/xlint/lint1/msg_030.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_030.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_030.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_030.exp Tue Apr 5 23:09:19 2022 @@ -1 +1,3 @@ -msg_030.c(6): error: syntax error ':' [249] +msg_030.c(10): warning: redeclaration of a; ANSI C requires static [30] +msg_030.c(14): warning: redeclaration of b; ANSI C requires static [30] +msg_030.c(18): warning: redeclaration of c; ANSI C requires static [30] Index: src/tests/usr.bin/xlint/lint1/msg_032.c diff -u src/tests/usr.bin/xlint/lint1/msg_032.c:1.2 src/tests/usr.bin/xlint/lint1/msg_032.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_032.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_032.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,12 @@ -/* $NetBSD: msg_032.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_032.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_032.c" // Test for message: argument type defaults to 'int': %s [32] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +add(a, b, c) +/* expect+3: warning: argument type defaults to 'int': a [32] */ +/* expect+2: warning: argument type defaults to 'int': b [32] */ +/* expect+1: warning: argument type defaults to 'int': c [32] */ +{ + return a + b + c; +} Index: src/tests/usr.bin/xlint/lint1/msg_032.exp diff -u src/tests/usr.bin/xlint/lint1/msg_032.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_032.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_032.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_032.exp Tue Apr 5 23:09:19 2022 @@ -1 +1,3 @@ -msg_032.c(6): error: syntax error ':' [249] +msg_032.c(10): warning: argument type defaults to 'int': a [32] +msg_032.c(10): warning: argument type defaults to 'int': b [32] +msg_032.c(10): warning: argument type defaults to 'int': c [32] Index: src/tests/usr.bin/xlint/lint1/msg_039.c diff -u src/tests/usr.bin/xlint/lint1/msg_039.c:1.2 src/tests/usr.bin/xlint/lint1/msg_039.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_039.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_039.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,13 @@ -/* $NetBSD: msg_039.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_039.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_039.c" -// Test for message: zero sized array in struct is a C99 extension: %s [39] +/* Test for message: zero sized array in struct is a C99 extension: %s [39] */ -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +/* lint1-flags: -w */ + +struct s { + /* expect+2: warning: zero sized array is a C99 extension [322] */ + /* expect+1: warning: zero sized array in struct is a C99 extension: member [39] */ + char member[0]; + char member2; +}; Index: src/tests/usr.bin/xlint/lint1/msg_039.exp diff -u src/tests/usr.bin/xlint/lint1/msg_039.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_039.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_039.exp:1.2 Sun Mar 21 20:44:59 2021 +++ src/tests/usr.bin/xlint/lint1/msg_039.exp Tue Apr 5 23:09:19 2022 @@ -1 +1,2 @@ -msg_039.c(6): error: syntax error ':' [249] +msg_039.c(11): warning: zero sized array is a C99 extension [322] +msg_039.c(11): warning: zero sized array in struct is a C99 extension: member [39] Index: src/tests/usr.bin/xlint/lint1/msg_040.c diff -u src/tests/usr.bin/xlint/lint1/msg_040.c:1.2 src/tests/usr.bin/xlint/lint1/msg_040.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_040.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_040.c Tue Apr 5 23:09:19 2022 @@ -1,7 +1,9 @@ -/* $NetBSD: msg_040.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_040.c,v 1.3 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_040.c" // Test for message: unknown size: %s [40] +/* 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." +/* lint1-flags: -Sw */ + +int var; Index: src/tests/usr.bin/xlint/lint1/msg_027.c diff -u src/tests/usr.bin/xlint/lint1/msg_027.c:1.5 src/tests/usr.bin/xlint/lint1/msg_027.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_027.c:1.5 Sun Sep 12 16:28:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_027.c Tue Apr 5 23:09:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_027.c,v 1.5 2021/09/12 16:28:45 rillig Exp $ */ +/* $NetBSD: msg_027.c,v 1.6 2022/04/05 23:09:19 rillig Exp $ */ # 3 "msg_027.c" // Test for message: redeclaration of %s [27] @@ -7,3 +7,10 @@ extern int identifier(void); /* expect+1: error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347] */ extern double identifier(void); + +enum { + constant, + /* expect+1: error: redeclaration of constant [27] */ + constant, + next +}; Index: src/tests/usr.bin/xlint/lint1/msg_027.exp diff -u src/tests/usr.bin/xlint/lint1/msg_027.exp:1.5 src/tests/usr.bin/xlint/lint1/msg_027.exp:1.6 --- src/tests/usr.bin/xlint/lint1/msg_027.exp:1.5 Sun Sep 12 16:28:45 2021 +++ src/tests/usr.bin/xlint/lint1/msg_027.exp Tue Apr 5 23:09:19 2022 @@ -1 +1,2 @@ msg_027.c(9): error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347] +msg_027.c(14): error: redeclaration of constant [27]