Module Name: src
Committed By: rillig
Date: Sat Nov 30 18:17:12 UTC 2024
Modified Files:
src/tests/usr.bin/xlint/lint2: msg_000.exp msg_001.exp msg_002.exp
msg_003.exp msg_004.exp msg_005.exp msg_006.exp msg_007.exp
msg_008.exp msg_009.exp msg_010.exp msg_011.exp msg_012.exp
msg_013.exp output_sorted.exp read.exp
src/tests/usr.bin/xlint/xlint: t_xlint.sh
src/usr.bin/xlint/lint2: check-msgs.lua chk.c msg.c read.c
Log Message:
lint: reword lint2 warnings, reduce punctuation
The previous diagnostics used unusual punctuation, for example by placing
spaces inside parentheses, as well as using space-space-tab and
double-colon as separators. Convert these diagnostics into readily
readable prose, and mark them clearly as coming from lint2, so that they
can be related to the tests in /usr/tests/usr.bin/xlint/lint2/msg_???.ln.
This change means that usr.bin/error no longer recognizes these messages
as coming from lint2, but that can be fixed later if necessary.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/msg_000.exp
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint2/msg_001.exp
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint2/msg_002.exp \
src/tests/usr.bin/xlint/lint2/msg_003.exp \
src/tests/usr.bin/xlint/lint2/msg_004.exp \
src/tests/usr.bin/xlint/lint2/msg_005.exp \
src/tests/usr.bin/xlint/lint2/msg_006.exp \
src/tests/usr.bin/xlint/lint2/msg_007.exp \
src/tests/usr.bin/xlint/lint2/msg_008.exp \
src/tests/usr.bin/xlint/lint2/msg_009.exp \
src/tests/usr.bin/xlint/lint2/msg_010.exp \
src/tests/usr.bin/xlint/lint2/msg_012.exp \
src/tests/usr.bin/xlint/lint2/msg_013.exp \
src/tests/usr.bin/xlint/lint2/output_sorted.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint2/msg_011.exp \
src/tests/usr.bin/xlint/lint2/read.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/xlint/t_xlint.sh
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint2/check-msgs.lua
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/xlint/lint2/msg.c
cvs rdiff -u -r1.92 -r1.93 src/usr.bin/xlint/lint2/read.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint2/msg_000.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_000.exp:1.1 src/tests/usr.bin/xlint/lint2/msg_000.exp:1.2
--- src/tests/usr.bin/xlint/lint2/msg_000.exp:1.1 Thu Aug 5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_000.exp Sat Nov 30 18:17:12 2024
@@ -1,2 +1,2 @@
-defined_not_used defined( msg_000.c(2) ), but never used
-used_not_defined used( msg_000.c(3) ), but not defined
+defined_not_used is defined in msg_000.c(2) but never used [lint2:001]
+used_not_defined is used in msg_000.c(3) but never defined [lint2:000]
Index: src/tests/usr.bin/xlint/lint2/msg_001.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_001.exp:1.3 src/tests/usr.bin/xlint/lint2/msg_001.exp:1.4
--- src/tests/usr.bin/xlint/lint2/msg_001.exp:1.3 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_001.exp Sat Nov 30 18:17:12 2024
@@ -1,2 +1,2 @@
-defined_not_used defined( msg_001.c(2) ), but never used
-used_not_defined used( msg_001.c(3) ), but not defined
+defined_not_used is defined in msg_001.c(2) but never used [lint2:001]
+used_not_defined is used in msg_001.c(3) but never defined [lint2:000]
Index: src/tests/usr.bin/xlint/lint2/msg_002.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_002.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_002.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_002.exp:1.2 Fri Aug 6 16:21:00 2021
+++ src/tests/usr.bin/xlint/lint2/msg_002.exp Sat Nov 30 18:17:12 2024
@@ -1,2 +1,2 @@
-defined defined( msg_002.c(3) ), but never used
-only_declared declared( msg_002.c(2) ), but never used or defined
+defined is defined in msg_002.c(3) but never used [lint2:001]
+only_declared is declared in msg_002.c(2) but never used or defined [lint2:002]
Index: src/tests/usr.bin/xlint/lint2/msg_003.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_003.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_003.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_003.exp:1.2 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_003.exp Sat Nov 30 18:17:12 2024
@@ -1,2 +1,2 @@
-function defined( msg_003_a.c(10) ), but never used
-function multiply defined msg_003_a.c(10) :: msg_003_b.c(10)
+function is defined in msg_003_a.c(10) but never used [lint2:001]
+function has multiple definitions in msg_003_a.c(10) and msg_003_b.c(10) [lint2:003]
Index: src/tests/usr.bin/xlint/lint2/msg_004.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_004.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_004.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_004.exp:1.2 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_004.exp Sat Nov 30 18:17:12 2024
@@ -1,6 +1,6 @@
-add value used inconsistently msg_004_define.c(2) :: msg_004_call.c(4)
-add value declared inconsistently (double != int) msg_004_define.c(2) :: msg_004_call.c(2)
-add, arg 1 used inconsistently msg_004_define.c(2)[double] :: msg_004_call.c(4)[int]
-add, arg 2 used inconsistently msg_004_define.c(2)[double] :: msg_004_call.c(4)[int]
-add, arg 1 declared inconsistently (double != int) msg_004_define.c(2) :: msg_004_call.c(2)
-add, arg 2 declared inconsistently (double != int) msg_004_define.c(2) :: msg_004_call.c(2)
+add has its return value used inconsistently by msg_004_define.c(2) and msg_004_call.c(4) [lint2:004]
+add returns 'double' at msg_004_define.c(2), versus 'int' at msg_004_call.c(2) [lint2:005]
+add has argument 1 with type 'double' at msg_004_define.c(2), versus 'int' at msg_004_call.c(4) [lint2:006]
+add has argument 2 with type 'double' at msg_004_define.c(2), versus 'int' at msg_004_call.c(4) [lint2:006]
+add has parameter 1 declared as 'double' in msg_004_define.c(2), versus 'int' in msg_004_call.c(2) [lint2:011]
+add has parameter 2 declared as 'double' in msg_004_define.c(2), versus 'int' in msg_004_call.c(2) [lint2:011]
Index: src/tests/usr.bin/xlint/lint2/msg_005.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_005.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_005.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_005.exp:1.2 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_005.exp Sat Nov 30 18:17:12 2024
@@ -1,6 +1,6 @@
-add value used inconsistently msg_005_define.c(2) :: msg_005_call.c(4)
-add value declared inconsistently (double != int) msg_005_define.c(2) :: msg_005_call.c(2)
-add, arg 1 used inconsistently msg_005_define.c(2)[double] :: msg_005_call.c(4)[int]
-add, arg 2 used inconsistently msg_005_define.c(2)[double] :: msg_005_call.c(4)[int]
-add, arg 1 declared inconsistently (double != int) msg_005_define.c(2) :: msg_005_call.c(2)
-add, arg 2 declared inconsistently (double != int) msg_005_define.c(2) :: msg_005_call.c(2)
+add has its return value used inconsistently by msg_005_define.c(2) and msg_005_call.c(4) [lint2:004]
+add returns 'double' at msg_005_define.c(2), versus 'int' at msg_005_call.c(2) [lint2:005]
+add has argument 1 with type 'double' at msg_005_define.c(2), versus 'int' at msg_005_call.c(4) [lint2:006]
+add has argument 2 with type 'double' at msg_005_define.c(2), versus 'int' at msg_005_call.c(4) [lint2:006]
+add has parameter 1 declared as 'double' in msg_005_define.c(2), versus 'int' in msg_005_call.c(2) [lint2:011]
+add has parameter 2 declared as 'double' in msg_005_define.c(2), versus 'int' in msg_005_call.c(2) [lint2:011]
Index: src/tests/usr.bin/xlint/lint2/msg_006.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_006.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_006.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_006.exp:1.2 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_006.exp Sat Nov 30 18:17:12 2024
@@ -1,6 +1,6 @@
-add value used inconsistently msg_006_define.c(2) :: msg_006_call.c(4)
-add value declared inconsistently (double != int) msg_006_define.c(2) :: msg_006_call.c(2)
-add, arg 1 used inconsistently msg_006_define.c(2)[double] :: msg_006_call.c(4)[int]
-add, arg 2 used inconsistently msg_006_define.c(2)[double] :: msg_006_call.c(4)[int]
-add, arg 1 declared inconsistently (double != int) msg_006_define.c(2) :: msg_006_call.c(2)
-add, arg 2 declared inconsistently (double != int) msg_006_define.c(2) :: msg_006_call.c(2)
+add has its return value used inconsistently by msg_006_define.c(2) and msg_006_call.c(4) [lint2:004]
+add returns 'double' at msg_006_define.c(2), versus 'int' at msg_006_call.c(2) [lint2:005]
+add has argument 1 with type 'double' at msg_006_define.c(2), versus 'int' at msg_006_call.c(4) [lint2:006]
+add has argument 2 with type 'double' at msg_006_define.c(2), versus 'int' at msg_006_call.c(4) [lint2:006]
+add has parameter 1 declared as 'double' in msg_006_define.c(2), versus 'int' in msg_006_call.c(2) [lint2:011]
+add has parameter 2 declared as 'double' in msg_006_define.c(2), versus 'int' in msg_006_call.c(2) [lint2:011]
Index: src/tests/usr.bin/xlint/lint2/msg_007.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_007.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_007.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_007.exp:1.2 Sat Nov 30 16:52:19 2024
+++ src/tests/usr.bin/xlint/lint2/msg_007.exp Sat Nov 30 18:17:12 2024
@@ -1,3 +1,3 @@
-params defined( msg_007_params.c(11) ), but never used
-params: variable # of args declared msg_007_params.c(11) :: msg_007_params.c(13)
-params: variable # of args declared msg_007_params.c(11) :: msg_007_params.c(14)
+params is defined in msg_007_params.c(11) but never used [lint2:001]
+params has 0 parameters in msg_007_params.c(11), versus 1 in msg_007_params.c(13) [lint2:012]
+params has 0 parameters in msg_007_params.c(11), versus 2 in msg_007_params.c(14) [lint2:012]
Index: src/tests/usr.bin/xlint/lint2/msg_008.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_008.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_008.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_008.exp:1.2 Sat Aug 14 14:25:51 2021
+++ src/tests/usr.bin/xlint/lint2/msg_008.exp Sat Nov 30 18:17:12 2024
@@ -1 +1 @@
-func returns value which is always ignored
+func returns a value that is always ignored [lint2:008]
Index: src/tests/usr.bin/xlint/lint2/msg_009.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_009.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_009.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_009.exp:1.2 Sat Aug 14 14:25:51 2021
+++ src/tests/usr.bin/xlint/lint2/msg_009.exp Sat Nov 30 18:17:12 2024
@@ -1 +1 @@
-func returns value which is sometimes ignored
+func returns a value that is sometimes ignored [lint2:009]
Index: src/tests/usr.bin/xlint/lint2/msg_010.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_010.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_010.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_010.exp:1.2 Sat Aug 14 14:25:51 2021
+++ src/tests/usr.bin/xlint/lint2/msg_010.exp Sat Nov 30 18:17:12 2024
@@ -1 +1 @@
-func value is used( msg_010.c?(30) ), but none returned
+func has its return value used in msg_010.c?(30) but doesn't return one [lint2:010]
Index: src/tests/usr.bin/xlint/lint2/msg_012.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_012.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_012.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_012.exp:1.2 Sat Aug 7 19:07:03 2021
+++ src/tests/usr.bin/xlint/lint2/msg_012.exp Sat Nov 30 18:17:12 2024
@@ -1 +1 @@
-add: variable # of args declared msg_012_a.c(2) :: msg_012_b.c(2)
+add has 2 parameters in msg_012_a.c(2), versus 3 in msg_012_b.c(2) [lint2:012]
Index: src/tests/usr.bin/xlint/lint2/msg_013.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_013.exp:1.2 src/tests/usr.bin/xlint/lint2/msg_013.exp:1.3
--- src/tests/usr.bin/xlint/lint2/msg_013.exp:1.2 Sat Aug 5 09:44:18 2023
+++ src/tests/usr.bin/xlint/lint2/msg_013.exp Sat Nov 30 18:17:12 2024
@@ -1,3 +1,3 @@
-my_printf: malformed format string local.c(12)
-my_printf: malformed format string local.c(13)
-my_printf, arg 2 inconsistent with format local.c(13)
+my_printf is called with a malformed format string in local.c(12) [lint2:013]
+my_printf is called with a malformed format string in local.c(13) [lint2:013]
+my_printf is called in local.c(13) with argument 2 being incompatible with format string [lint2:014]
Index: src/tests/usr.bin/xlint/lint2/output_sorted.exp
diff -u src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.2 src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.3
--- src/tests/usr.bin/xlint/lint2/output_sorted.exp:1.2 Sat Aug 28 19:49:28 2021
+++ src/tests/usr.bin/xlint/lint2/output_sorted.exp Sat Nov 30 18:17:12 2024
@@ -1,27 +1,27 @@
-func0000 used( output_sorted.c(10) ), but not defined
-func0000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func0000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func1000 used( output_sorted.c(10) ), but not defined
-func1000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func1000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func2000 used( output_sorted.c(10) ), but not defined
-func2000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func2000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func3000 used( output_sorted.c(10) ), but not defined
-func3000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func3000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func4000 used( output_sorted.c(10) ), but not defined
-func4000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func4000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func5000 used( output_sorted.c(10) ), but not defined
-func5000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func5000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func6000 used( output_sorted.c(10) ), but not defined
-func6000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func6000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-func7000 used( output_sorted.c(10) ), but not defined
-func7000, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-func7000, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
-no_prototype used( output_sorted.c(10) ), but not defined
-no_prototype, arg 1 used inconsistently output_sorted.c(10)[int] :: output_sorted.c(11)[pointer to const char]
-no_prototype, arg 2 used inconsistently output_sorted.c(10)[pointer to const char] :: output_sorted.c(11)[double]
+func0000 is used in output_sorted.c(10) but never defined [lint2:000]
+func0000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func0000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func1000 is used in output_sorted.c(10) but never defined [lint2:000]
+func1000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func1000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func2000 is used in output_sorted.c(10) but never defined [lint2:000]
+func2000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func2000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func3000 is used in output_sorted.c(10) but never defined [lint2:000]
+func3000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func3000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func4000 is used in output_sorted.c(10) but never defined [lint2:000]
+func4000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func4000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func5000 is used in output_sorted.c(10) but never defined [lint2:000]
+func5000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func5000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func6000 is used in output_sorted.c(10) but never defined [lint2:000]
+func6000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func6000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+func7000 is used in output_sorted.c(10) but never defined [lint2:000]
+func7000 has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+func7000 has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
+no_prototype is used in output_sorted.c(10) but never defined [lint2:000]
+no_prototype has argument 1 with type 'int' at output_sorted.c(10), versus 'pointer to const char' at output_sorted.c(11) [lint2:006]
+no_prototype has argument 2 with type 'pointer to const char' at output_sorted.c(10), versus 'double' at output_sorted.c(11) [lint2:006]
Index: src/tests/usr.bin/xlint/lint2/msg_011.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_011.exp:1.4 src/tests/usr.bin/xlint/lint2/msg_011.exp:1.5
--- src/tests/usr.bin/xlint/lint2/msg_011.exp:1.4 Sat Nov 30 16:34:27 2024
+++ src/tests/usr.bin/xlint/lint2/msg_011.exp Sat Nov 30 18:17:12 2024
@@ -1,11 +1,11 @@
-add value used inconsistently msg_011_define.c(2) :: msg_011_call.c(4)
-add value declared inconsistently (double != int) msg_011_define.c(2) :: msg_011_call.c(2)
-add, arg 1 used inconsistently msg_011_define.c(2)[double] :: msg_011_call.c(4)[int]
-add, arg 2 used inconsistently msg_011_define.c(2)[double] :: msg_011_call.c(4)[int]
-add, arg 1 declared inconsistently (double != int) msg_011_define.c(2) :: msg_011_call.c(2)
-add, arg 2 declared inconsistently (double != int) msg_011_define.c(2) :: msg_011_call.c(2)
-func_param defined( msg_011_call_func.c(11) ), but never used
-func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function() returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(12)
-func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(void) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(13)
-func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(double) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(14)
-func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(double, double) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(15)
+add has its return value used inconsistently by msg_011_define.c(2) and msg_011_call.c(4) [lint2:004]
+add returns 'double' at msg_011_define.c(2), versus 'int' at msg_011_call.c(2) [lint2:005]
+add has argument 1 with type 'double' at msg_011_define.c(2), versus 'int' at msg_011_call.c(4) [lint2:006]
+add has argument 2 with type 'double' at msg_011_define.c(2), versus 'int' at msg_011_call.c(4) [lint2:006]
+add has parameter 1 declared as 'double' in msg_011_define.c(2), versus 'int' in msg_011_call.c(2) [lint2:011]
+add has parameter 2 declared as 'double' in msg_011_define.c(2), versus 'int' in msg_011_call.c(2) [lint2:011]
+func_param is defined in msg_011_call_func.c(11) but never used [lint2:001]
+func_param has parameter 1 declared as 'pointer to function(char) returning void' in msg_011_call_func.c(11), versus 'pointer to function() returning void' in msg_011_call_func.c(12) [lint2:011]
+func_param has parameter 1 declared as 'pointer to function(char) returning void' in msg_011_call_func.c(11), versus 'pointer to function(void) returning void' in msg_011_call_func.c(13) [lint2:011]
+func_param has parameter 1 declared as 'pointer to function(char) returning void' in msg_011_call_func.c(11), versus 'pointer to function(double) returning void' in msg_011_call_func.c(14) [lint2:011]
+func_param has parameter 1 declared as 'pointer to function(char) returning void' in msg_011_call_func.c(11), versus 'pointer to function(double, double) returning void' in msg_011_call_func.c(15) [lint2:011]
Index: src/tests/usr.bin/xlint/lint2/read.exp
diff -u src/tests/usr.bin/xlint/lint2/read.exp:1.4 src/tests/usr.bin/xlint/lint2/read.exp:1.5
--- src/tests/usr.bin/xlint/lint2/read.exp:1.4 Mon Aug 30 21:23:37 2021
+++ src/tests/usr.bin/xlint/lint2/read.exp Sat Nov 30 18:17:12 2024
@@ -1,15 +1,15 @@
-a125 declared( read.c(125) ), but never used or defined
-inline_function defined( read.c(256) ), but never used
-inline_function value declared inconsistently (void != int) read.c(256) :: read.c(260)
-printflike_0_comment defined( read.c(217) ), but never used
-printflike_10_comment defined( read.c(229) ), but never used
-printflike_3_comment defined( read.c(223) ), but never used
-printflike_comment defined( read.c(211) ), but never used
-scanflike_0_comment defined( read.c(243) ), but never used
-scanflike_3_comment defined( read.c(249) ), but never used
-scanflike_comment defined( read.c(237) ), but never used
-used_function value declared inconsistently (int != void) read.c(254) :: read.c(253)
-used_function returns value which is sometimes ignored
-varargs_0_comment defined( read.c(199) ), but never used
-varargs_3_comment defined( read.c(205) ), but never used
-varargs_comment defined( read.c(193) ), but never used
+a125 is declared in read.c(125) but never used or defined [lint2:002]
+inline_function is defined in read.c(256) but never used [lint2:001]
+inline_function returns 'void' at read.c(256), versus 'int' at read.c(260) [lint2:005]
+printflike_0_comment is defined in read.c(217) but never used [lint2:001]
+printflike_10_comment is defined in read.c(229) but never used [lint2:001]
+printflike_3_comment is defined in read.c(223) but never used [lint2:001]
+printflike_comment is defined in read.c(211) but never used [lint2:001]
+scanflike_0_comment is defined in read.c(243) but never used [lint2:001]
+scanflike_3_comment is defined in read.c(249) but never used [lint2:001]
+scanflike_comment is defined in read.c(237) but never used [lint2:001]
+used_function returns 'int' at read.c(254), versus 'void' at read.c(253) [lint2:005]
+used_function returns a value that is sometimes ignored [lint2:009]
+varargs_0_comment is defined in read.c(199) but never used [lint2:001]
+varargs_3_comment is defined in read.c(205) but never used [lint2:001]
+varargs_comment is defined in read.c(193) but never used [lint2:001]
Index: src/tests/usr.bin/xlint/xlint/t_xlint.sh
diff -u src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.4 src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.5
--- src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.4 Thu Sep 7 06:24:31 2023
+++ src/tests/usr.bin/xlint/xlint/t_xlint.sh Sat Nov 30 18:17:12 2024
@@ -1,4 +1,4 @@
-# $NetBSD: t_xlint.sh,v 1.4 2023/09/07 06:24:31 rillig Exp $
+# $NetBSD: t_xlint.sh,v 1.5 2024/11/30 18:17:12 rillig Exp $
#
# Copyright (c) 2023 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -109,7 +109,7 @@ run_lint2_body()
# Depending on whether the lint libraries are installed or not, there
# may be a warning 'cannot find llib-lc.ln' on stderr.
atf_check \
- -o 'inline:function defined( input.c(4) ), but never used\n' \
+ -o 'inline:function is defined in input.c(4) but never used [lint2:001]\n' \
-e 'ignore' \
"$lint" -aabceghprSTxz input.ln
}
Index: src/usr.bin/xlint/lint2/check-msgs.lua
diff -u src/usr.bin/xlint/lint2/check-msgs.lua:1.2 src/usr.bin/xlint/lint2/check-msgs.lua:1.3
--- src/usr.bin/xlint/lint2/check-msgs.lua:1.2 Fri Sep 10 21:05:08 2021
+++ src/usr.bin/xlint/lint2/check-msgs.lua Sat Nov 30 18:17:11 2024
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.2 2021/09/10 21:05:08 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.3 2024/11/30 18:17:11 rillig Exp $
--[[
@@ -16,7 +16,7 @@ local function load_messages(fname)
local f = assert(io.open(fname, "r"))
for line in f:lines() do
- local msg, id = line:match("%s*\"(.+)\",%s*/%*%s*(%d+)%s*%*/$")
+ local msg, id = line:match("%s*\"(.+)\",%s*// (%d+)$")
if msg ~= nil then
msgs[tonumber(id)] = msg
end
Index: src/usr.bin/xlint/lint2/chk.c
diff -u src/usr.bin/xlint/lint2/chk.c:1.67 src/usr.bin/xlint/lint2/chk.c:1.68
--- src/usr.bin/xlint/lint2/chk.c:1.67 Sun May 12 18:49:36 2024
+++ src/usr.bin/xlint/lint2/chk.c Sat Nov 30 18:17:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.67 2024/05/12 18:49:36 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.68 2024/11/30 18:17:11 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: chk.c,v 1.67 2024/05/12 18:49:36 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.68 2024/11/30 18:17:11 rillig Exp $");
#endif
#include <ctype.h>
@@ -140,10 +140,10 @@ check_used_not_defined(const hte_t *hte)
return;
if ((fcall = hte->h_calls) != NULL) {
- /* %s used( %s ), but not defined */
+ /* %s is used in %s but never defined */
msg(0, hte->h_name, mkpos(&fcall->f_pos));
} else if ((usym = hte->h_usyms) != NULL) {
- /* %s used( %s ), but not defined */
+ /* %s is used in %s but never defined */
msg(0, hte->h_name, mkpos(&usym->u_pos));
}
}
@@ -161,7 +161,7 @@ check_defined_not_used(const hte_t *hte)
for (sym = hte->h_syms; sym != NULL; sym = sym->s_next) {
if (sym->s_def == DEF || sym->s_def == TDEF) {
- /* %s defined( %s ), but never used */
+ /* %s is defined in %s but never used */
msg(1, hte->h_name, mkpos(&sym->s_pos));
break;
}
@@ -186,7 +186,7 @@ check_declared_not_used_or_defined(const
if (sym->s_def != DECL)
errx(1, "internal error: check_declared_not_used_or_defined");
- /* %s declared( %s ), but never used or defined */
+ /* %s is declared in %s but never used or defined */
msg(2, hte->h_name, mkpos(&sym->s_pos));
}
@@ -216,7 +216,7 @@ check_multiple_definitions(const hte_t *
def1 = sym;
continue;
}
- /* %s multiply defined \t%s :: %s */
+ /* %s has multiple definitions in %s and %s */
msg(3, hte->h_name, mkpos(&def1->s_pos), mkpos(&sym->s_pos));
}
}
@@ -255,28 +255,28 @@ chkvtui(const hte_t *hte, sym_t *def, sy
/* no return value used */
if ((t1 == STRUCT || t1 == UNION) && !eq) {
/*
- * If a function returns a struct or union it
+ * If a function returns a struct or union, it
* must be declared to return a struct or
- * union, also if the return value is ignored.
+ * union, even if the return value is ignored.
* This is necessary because the caller must
* allocate stack space for the return value.
* If it does not, the return value would
* overwrite other data.
*
- * XXX Following message may be confusing
- * because it appears also if the return value
+ * XXX: The following message may be confusing
+ * because it occurs also if the return value
* was declared inconsistently. But this
* behavior matches pcc-based lint, so it is
* accepted for now.
*/
- /* %s function value must be declared ... */
+ /* %s's return type in %s must be decl... */
msg(17, hte->h_name,
mkpos(&def->s_pos), mkpos(&call->f_pos));
}
continue;
}
if (!eq || (sflag && dowarn)) {
- /* %s value used inconsistently \t%s :: %s */
+ /* %s has its return value used inconsistently ... */
msg(4, hte->h_name,
mkpos(&def->s_pos), mkpos(&call->f_pos));
}
@@ -315,13 +315,21 @@ chkvtdi(const hte_t *hte, sym_t *def, sy
false, false, false, &dowarn);
}
if (!eq || (sflag && dowarn)) {
- /* %s value declared inconsistently (%s != %s) \t... */
- msg(5, hte->h_name, type_name(xt1), type_name(xt2),
- mkpos(&def->s_pos), mkpos(&sym->s_pos));
+ /* %s returns '%s' at %s, versus '%s' at %s */
+ msg(5, hte->h_name, type_name(xt1), mkpos(&def->s_pos),
+ type_name(xt2), mkpos(&sym->s_pos));
}
}
}
+static int
+total_args(int n, type_t **tpp)
+{
+ for (; *tpp != NULL; tpp++)
+ n++;
+ return n;
+}
+
/*
* Print a warning if a function is called with arguments which does
* not match the function definition, declaration or another call
@@ -396,8 +404,9 @@ chkfaui(const hte_t *hte, sym_t *def, sy
* prototype.
*/
} else {
- /* %s: variable # of args \t%s :: %s */
- msg(7, hte->h_name, mkpos(pos1p), mkpos(&call->f_pos));
+ /* %s has %d parameters in %s, versus %d ... */
+ msg(7, hte->h_name, total_args(n, ap1), mkpos(pos1p),
+ total_args(n, ap2), mkpos(&call->f_pos));
continue;
}
@@ -578,9 +587,9 @@ chkau(const hte_t *hte, int n, sym_t *de
return;
}
- /* %s, arg %d used inconsistently \t%s[%s] :: %s[%s] */
- msg(6, hte->h_name, n, mkpos(pos1p), type_name(arg1),
- mkpos(&call->f_pos), type_name(arg2));
+ /* %s has argument %d with type '%s' at %s, versus '%s' at %s */
+ msg(6, hte->h_name, n, type_name(arg1), mkpos(pos1p),
+ type_name(arg2), mkpos(&call->f_pos));
}
/*
@@ -1009,7 +1018,7 @@ static void
bad_format_string(const hte_t *hte, fcall_t *call)
{
- /* %s: malformed format string \t%s */
+ /* %s is called with a malformed format string in %s */
msg(13, hte->h_name, mkpos(&call->f_pos));
}
@@ -1017,15 +1026,15 @@ static void
inconsistent_arguments(const hte_t *hte, fcall_t *call, int n)
{
- /* %s, arg %d inconsistent with format \t%s */
- msg(14, hte->h_name, n, mkpos(&call->f_pos));
+ /* %s is called in %s with argument %d being incompatible with ... */
+ msg(14, hte->h_name, mkpos(&call->f_pos), n);
}
static void
too_few_arguments(const hte_t *hte, fcall_t *call)
{
- /* %s: too few args for format \t%s */
+ /* %s is called in %s with too few arguments for format string */
msg(15, hte->h_name, mkpos(&call->f_pos));
}
@@ -1033,7 +1042,7 @@ static void
too_many_arguments(const hte_t *hte, fcall_t *call)
{
- /* %s: too many args for format \t%s */
+ /* %s is called in %s with too many arguments for format string */
msg(16, hte->h_name, mkpos(&call->f_pos));
}
@@ -1090,17 +1099,17 @@ check_return_values(const hte_t *hte, sy
ignored |= !call->f_rused && !call->f_rdisc;
}
if (!used && ignored) {
- /* %s returns value which is always ignored */
+ /* %s returns a value that is always ignored */
msg(8, hte->h_name);
} else if (used && ignored) {
- /* %s returns value which is sometimes ignored */
+ /* %s returns a value that is sometimes ignored */
msg(9, hte->h_name);
}
} else {
/* function has no return value */
for (call = hte->h_calls; call != NULL; call = call->f_next) {
if (call->f_rused)
- /* %s value is used( %s ), but none returned */
+ /* %s has its return value used in %s but doesn't return one */
msg(10, hte->h_name, mkpos(&call->f_pos));
}
}
@@ -1146,10 +1155,10 @@ check_argument_declarations(const hte_t
eq = types_compatible(xt1 = *ap1, xt2 = *ap2,
true, osdef, false, &dowarn);
if (!eq || dowarn) {
- /* %s, arg %d declared inconsistently ... */
+ /* %s has parameter %d declared as '%s' ... */
msg(11, hte->h_name, n + 1,
- type_name(xt1), type_name(xt2),
- mkpos(&sym1->s_pos), mkpos(&sym->s_pos));
+ type_name(xt1), mkpos(&sym1->s_pos),
+ type_name(xt2), mkpos(&sym->s_pos));
}
n++;
ap1++;
@@ -1165,8 +1174,10 @@ check_argument_declarations(const hte_t
continue;
}
}
- /* %s: variable # of args declared \t%s :: %s */
- msg(12, hte->h_name, mkpos(&sym1->s_pos), mkpos(&sym->s_pos));
+ /* %s has %d parameters in %s, versus %d in %s */
+ msg(12, hte->h_name,
+ total_args(n, ap1), mkpos(&sym1->s_pos),
+ total_args(n, ap2), mkpos(&sym->s_pos));
}
}
Index: src/usr.bin/xlint/lint2/msg.c
diff -u src/usr.bin/xlint/lint2/msg.c:1.25 src/usr.bin/xlint/lint2/msg.c:1.26
--- src/usr.bin/xlint/lint2/msg.c:1.25 Sun Dec 3 18:17:41 2023
+++ src/usr.bin/xlint/lint2/msg.c Sat Nov 30 18:17:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.c,v 1.25 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: msg.c,v 1.26 2024/11/30 18:17:12 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: msg.c,v 1.25 2023/12/03 18:17:41 rillig Exp $");
+__RCSID("$NetBSD: msg.c,v 1.26 2024/11/30 18:17:12 rillig Exp $");
#endif
#include <stdarg.h>
@@ -46,26 +46,26 @@ __RCSID("$NetBSD: msg.c,v 1.25 2023/12/0
#include "lint2.h"
-static const char *msgs[] = {
- "%s used( %s ), but not defined", /* 0 */
- "%s defined( %s ), but never used", /* 1 */
- "%s declared( %s ), but never used or defined", /* 2 */
- "%s multiply defined \t%s :: %s", /* 3 */
- "%s value used inconsistently \t%s :: %s", /* 4 */
- "%s value declared inconsistently (%s != %s) \t%s :: %s", /* 5 */
- "%s, arg %d used inconsistently \t%s[%s] :: %s[%s]", /* 6 */
- "%s: variable # of args \t%s :: %s", /* 7 */
- "%s returns value which is always ignored", /* 8 */
- "%s returns value which is sometimes ignored", /* 9 */
- "%s value is used( %s ), but none returned", /* 10 */
- "%s, arg %d declared inconsistently (%s != %s)\t%s :: %s", /* 11 */
- "%s: variable # of args declared \t%s :: %s", /* 12 */
- "%s: malformed format string \t%s", /* 13 */
- "%s, arg %d inconsistent with format \t%s", /* 14 */
- "%s: too few args for format \t%s", /* 15 */
- "%s: too many args for format \t%s", /* 16 */
- "%s function value must be declared before use \t%s :: %s",/* 17 */
- "%s renamed multiple times \t%s :: %s", /* 18 */
+static const char *msgs[] = {
+ "%s is used in %s but never defined", // 0
+ "%s is defined in %s but never used", // 1
+ "%s is declared in %s but never used or defined", // 2
+ "%s has multiple definitions in %s and %s", // 3
+ "%s has its return value used inconsistently by %s and %s", // 4
+ "%s returns '%s' at %s, versus '%s' at %s", // 5
+ "%s has argument %d with type '%s' at %s, versus '%s' at %s", // 6
+ "%s has %d parameters in %s, versus %d arguments in %s", // 7
+ "%s returns a value that is always ignored", // 8
+ "%s returns a value that is sometimes ignored", // 9
+ "%s has its return value used in %s but doesn't return one", // 10
+ "%s has parameter %d declared as '%s' in %s, versus '%s' in %s", // 11
+ "%s has %d parameters in %s, versus %d in %s", // 12
+ "%s is called with a malformed format string in %s", // 13
+ "%s is called in %s with argument %d being incompatible with format string", // 14
+ "%s is called in %s with too few arguments for format string", // 15
+ "%s is called in %s with too many arguments for format string", // 16
+ "%s's return type in %s must be declared before use in %s", // 17
+ "%s is renamed multiple times in %s and %s", // 18
};
void
@@ -76,7 +76,7 @@ msg(int n, ...)
va_start(ap, n);
(void)vprintf(msgs[n], ap);
- (void)printf("\n");
+ (void)printf(" [lint2:%03d]\n", n);
va_end(ap);
}
Index: src/usr.bin/xlint/lint2/read.c
diff -u src/usr.bin/xlint/lint2/read.c:1.92 src/usr.bin/xlint/lint2/read.c:1.93
--- src/usr.bin/xlint/lint2/read.c:1.92 Sun May 12 18:49:36 2024
+++ src/usr.bin/xlint/lint2/read.c Sat Nov 30 18:17:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.92 2024/05/12 18:49:36 rillig Exp $ */
+/* $NetBSD: read.c,v 1.93 2024/11/30 18:17:12 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: read.c,v 1.92 2024/05/12 18:49:36 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.93 2024/11/30 18:17:12 rillig Exp $");
#endif
#include <ctype.h>
@@ -496,7 +496,7 @@ decldef(pos_t pos, const char *cp)
renamed = true;
} else if (hte = renamehte->h_hte,
strcmp(hte->h_name, newname) != 0) {
- /* %s renamed multiple times \t%s :: %s */
+ /* %s is renamed multiple times in %s and %s */
msg(18, tname, mkpos(&renamehte->h_syms->s_pos),
mkpos(&sym.s_pos));
}