Module Name: src
Committed By: rillig
Date: Fri Jul 7 06:03:31 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: d_init_array_using_string.c decl.c
gcc_attribute_var.c msg_011.c msg_083.c msg_090.c msg_092.c
msg_095.c msg_097.c msg_124.c msg_128.c msg_165.c msg_169.c
msg_182.c msg_188.c msg_240.c msg_247.c msg_277.c msg_324.c
msg_327.c
src/usr.bin/xlint/lint1: decl.c err.c externs1.h main1.c tree.c
Log Message:
lint: only skip 'unused' warnings after errors, not other warnings
Previously, in -w mode, any warning suppressed further 'unused'
warnings, even though there was no need to do that. This can be seen in
the test gcc_attribute_var.c, where only the last unused variable from a
function was marked as unused, the others slipped through.
Fixed by counting the errors and the warnings separately and only
combining them if actually desired.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c \
src/tests/usr.bin/xlint/lint1/msg_124.c
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_011.c \
src/tests/usr.bin/xlint/lint1/msg_128.c \
src/tests/usr.bin/xlint/lint1/msg_188.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_083.c \
src/tests/usr.bin/xlint/lint1/msg_090.c \
src/tests/usr.bin/xlint/lint1/msg_095.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_092.c \
src/tests/usr.bin/xlint/lint1/msg_097.c \
src/tests/usr.bin/xlint/lint1/msg_165.c \
src/tests/usr.bin/xlint/lint1/msg_182.c \
src/tests/usr.bin/xlint/lint1/msg_240.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_169.c \
src/tests/usr.bin/xlint/lint1/msg_277.c \
src/tests/usr.bin/xlint/lint1/msg_324.c \
src/tests/usr.bin/xlint/lint1/msg_327.c
cvs rdiff -u -r1.30 -r1.31 src/tests/usr.bin/xlint/lint1/msg_247.c
cvs rdiff -u -r1.341 -r1.342 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.204 -r1.205 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.188 -r1.189 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.547 -r1.548 src/usr.bin/xlint/lint1/tree.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/lint1/d_init_array_using_string.c
diff -u src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.13 src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.14
--- src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c:1.13 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/d_init_array_using_string.c Fri Jul 7 06:03:31 2023
@@ -1,11 +1,11 @@
-/* $NetBSD: d_init_array_using_string.c,v 1.13 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: d_init_array_using_string.c,v 1.14 2023/07/07 06:03:31 rillig Exp $ */
# 3 "d_init_array_using_string.c"
/*
* Test initialization of arrays and pointers by string literals.
*/
-/* lint1-extra-flags: -X 351 */
+/* lint1-extra-flags: -X 191,351 */
void sink(const void *);
Index: src/tests/usr.bin/xlint/lint1/msg_124.c
diff -u src/tests/usr.bin/xlint/lint1/msg_124.c:1.13 src/tests/usr.bin/xlint/lint1/msg_124.c:1.14
--- src/tests/usr.bin/xlint/lint1/msg_124.c:1.13 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_124.c Fri Jul 7 06:03:31 2023
@@ -1,9 +1,9 @@
-/* $NetBSD: msg_124.c,v 1.13 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: msg_124.c,v 1.14 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_124.c"
// Test for message: illegal combination of '%s' and '%s', op '%s' [124]
-/* lint1-extra-flags: -s -X 351 */
+/* lint1-extra-flags: -s -X 191,351 */
typedef void(*signal_handler)(int);
Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.21 src/tests/usr.bin/xlint/lint1/decl.c:1.22
--- src/tests/usr.bin/xlint/lint1/decl.c:1.21 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/decl.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.21 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.22 2023/07/07 06:03:31 rillig Exp $ */
# 3 "decl.c"
/*
@@ -6,7 +6,7 @@
* declaration-specifiers and the declarators.
*/
-/* lint1-extra-flags: -X 351 */
+/* lint1-extra-flags: -X 191,351 */
/*
* Even though 'const' comes after 'char' and is therefore quite close to the
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.8 src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.9
--- src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c:1.8 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute_var.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_attribute_var.c,v 1.8 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: gcc_attribute_var.c,v 1.9 2023/07/07 06:03:31 rillig Exp $ */
# 3 "gcc_attribute_var.c"
/*
@@ -52,6 +52,7 @@ void println(void);
void
ambiguity_for_attribute(void)
{
+ /* expect+1: warning: 'var1' unused in function 'ambiguity_for_attribute' [192] */
__attribute__((unused)) _Bool var1;
switch (1) {
Index: src/tests/usr.bin/xlint/lint1/msg_011.c
diff -u src/tests/usr.bin/xlint/lint1/msg_011.c:1.5 src/tests/usr.bin/xlint/lint1/msg_011.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_011.c:1.5 Thu Aug 26 19:23:25 2021
+++ src/tests/usr.bin/xlint/lint1/msg_011.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_011.c,v 1.5 2021/08/26 19:23:25 rillig Exp $ */
+/* $NetBSD: msg_011.c,v 1.6 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_011.c"
// Test for message: bit-field initializer out of range [11]
@@ -9,6 +9,7 @@ example(void)
struct {
signed int si: 3;
unsigned int ui: 3;
+ /* expect+1: warning: 's' set but not used in function 'example' [191] */
} s[] = {
/* expect+2: warning: bit-field initializer out of range [11] */
/* expect+1: warning: initialization of unsigned with negative constant [221] */
Index: src/tests/usr.bin/xlint/lint1/msg_128.c
diff -u src/tests/usr.bin/xlint/lint1/msg_128.c:1.5 src/tests/usr.bin/xlint/lint1/msg_128.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_128.c:1.5 Wed Jun 22 19:23:18 2022
+++ src/tests/usr.bin/xlint/lint1/msg_128.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_128.c,v 1.5 2022/06/22 19:23:18 rillig Exp $ */
+/* $NetBSD: msg_128.c,v 1.6 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_128.c"
// Test for message: operands of '%s' have incompatible pointer types to '%s' and '%s' [128]
@@ -7,6 +7,7 @@ void
conversion_to_unconst(const char *cstr)
{
char *str;
+ /* expect+2: warning: 'str' set but not used in function 'conversion_to_unconst' [191] */
/* expect+1: warning: operands of '=' have incompatible pointer types to 'char' and 'const char' [128] */
str = cstr;
}
Index: src/tests/usr.bin/xlint/lint1/msg_188.c
diff -u src/tests/usr.bin/xlint/lint1/msg_188.c:1.5 src/tests/usr.bin/xlint/lint1/msg_188.c:1.6
--- src/tests/usr.bin/xlint/lint1/msg_188.c:1.5 Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_188.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_188.c,v 1.5 2023/03/28 14:44:35 rillig Exp $ */
+/* $NetBSD: msg_188.c,v 1.6 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_188.c"
/* Test for message: no automatic aggregate initialization in traditional C [188] */
@@ -18,6 +18,7 @@ struct point global = {
void
function()
{
+ /* expect+2: warning: 'local' set but not used in function 'function' [191] */
/* expect+1: warning: no automatic aggregate initialization in traditional C [188] */
struct point local = {
3,
Index: src/tests/usr.bin/xlint/lint1/msg_083.c
diff -u src/tests/usr.bin/xlint/lint1/msg_083.c:1.6 src/tests/usr.bin/xlint/lint1/msg_083.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_083.c:1.6 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_083.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_083.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: msg_083.c,v 1.7 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_083.c"
// Test for message: storage class after type is obsolescent [83]
@@ -8,6 +8,7 @@
void
example(void)
{
+ /* expect+2: warning: 'x' unused in function 'example' [192] */
/* expect+1: warning: storage class after type is obsolescent [83] */
int register x;
}
Index: src/tests/usr.bin/xlint/lint1/msg_090.c
diff -u src/tests/usr.bin/xlint/lint1/msg_090.c:1.6 src/tests/usr.bin/xlint/lint1/msg_090.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_090.c:1.6 Tue Mar 28 20:04:52 2023
+++ src/tests/usr.bin/xlint/lint1/msg_090.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_090.c,v 1.6 2023/03/28 20:04:52 rillig Exp $ */
+/* $NetBSD: msg_090.c,v 1.7 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_090.c"
// Test for message: inconsistent redeclaration of extern '%s' [90]
@@ -10,6 +10,7 @@ extern int random_number(void);
void
use(void)
{
+ /* expect+3: warning: 'random_number' unused in function 'use' [192] */
/* expect+2: warning: nested 'extern' declaration of 'random_number' [352] */
/* expect+1: warning: inconsistent redeclaration of extern 'random_number' [90] */
extern int random_number(int);
Index: src/tests/usr.bin/xlint/lint1/msg_095.c
diff -u src/tests/usr.bin/xlint/lint1/msg_095.c:1.6 src/tests/usr.bin/xlint/lint1/msg_095.c:1.7
--- src/tests/usr.bin/xlint/lint1/msg_095.c:1.6 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/msg_095.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_095.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */
+/* $NetBSD: msg_095.c,v 1.7 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_095.c"
// Test for message: declaration of '%s' hides earlier one [95]
@@ -12,6 +12,7 @@ example(int identifier)
{
{
+ /* expect+2: warning: 'identifier' set but not used in function 'example' [191] */
/* expect+1: warning: declaration of 'identifier' hides earlier one [95] */
int identifier = 3;
}
Index: src/tests/usr.bin/xlint/lint1/msg_092.c
diff -u src/tests/usr.bin/xlint/lint1/msg_092.c:1.4 src/tests/usr.bin/xlint/lint1/msg_092.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_092.c:1.4 Tue Jun 21 21:18:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_092.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_092.c,v 1.4 2022/06/21 21:18:30 rillig Exp $ */
+/* $NetBSD: msg_092.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_092.c"
// Test for message: inconsistent redeclaration of static '%s' [92]
@@ -14,6 +14,7 @@ use_random(void)
{
random();
+ /* expect+3: warning: 'random' unused in function 'use_random' [192] */
/* expect+2: warning: dubious static function 'random' at block level [93] */
/* expect+1: warning: inconsistent redeclaration of static 'random' [92] */
static double random(void);
Index: src/tests/usr.bin/xlint/lint1/msg_097.c
diff -u src/tests/usr.bin/xlint/lint1/msg_097.c:1.4 src/tests/usr.bin/xlint/lint1/msg_097.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_097.c:1.4 Sun Apr 3 09:34:45 2022
+++ src/tests/usr.bin/xlint/lint1/msg_097.c Fri Jul 7 06:03:31 2023
@@ -1,9 +1,9 @@
-/* $NetBSD: msg_097.c,v 1.4 2022/04/03 09:34:45 rillig Exp $ */
+/* $NetBSD: msg_097.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_097.c"
/* Test for message: suffix U is illegal in traditional C [97] */
-/* lint1-flags: -gtw */
+/* lint1-flags: -gtw -X 191 */
void
example()
Index: src/tests/usr.bin/xlint/lint1/msg_165.c
diff -u src/tests/usr.bin/xlint/lint1/msg_165.c:1.4 src/tests/usr.bin/xlint/lint1/msg_165.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_165.c:1.4 Thu Jun 16 16:58:36 2022
+++ src/tests/usr.bin/xlint/lint1/msg_165.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_165.c,v 1.4 2022/06/16 16:58:36 rillig Exp $ */
+/* $NetBSD: msg_165.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_165.c"
// Test for message: constant truncated by assignment [165]
@@ -8,6 +8,7 @@ example(void)
{
unsigned char ch;
+ /* expect+2: warning: 'ch' set but not used in function 'example' [191] */
/* expect+1: warning: constant truncated by assignment [165] */
ch = 0x1234;
}
Index: src/tests/usr.bin/xlint/lint1/msg_182.c
diff -u src/tests/usr.bin/xlint/lint1/msg_182.c:1.4 src/tests/usr.bin/xlint/lint1/msg_182.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_182.c:1.4 Wed Jun 22 19:23:18 2022
+++ src/tests/usr.bin/xlint/lint1/msg_182.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_182.c,v 1.4 2022/06/22 19:23:18 rillig Exp $ */
+/* $NetBSD: msg_182.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_182.c"
// Test for message: incompatible pointer types to '%s' and '%s' [182]
@@ -13,6 +13,7 @@ return_discarding_volatile(volatile void
void
init_discarding_volatile(volatile void *arg)
{
+ /* expect+2: warning: 'array' set but not used in function 'init_discarding_volatile' [191] */
/* expect+1: warning: incompatible pointer types to 'void' and 'volatile void' [182] */
void *array[] = { arg };
}
Index: src/tests/usr.bin/xlint/lint1/msg_240.c
diff -u src/tests/usr.bin/xlint/lint1/msg_240.c:1.4 src/tests/usr.bin/xlint/lint1/msg_240.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_240.c:1.4 Fri Jul 1 20:53:13 2022
+++ src/tests/usr.bin/xlint/lint1/msg_240.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_240.c,v 1.4 2022/07/01 20:53:13 rillig Exp $ */
+/* $NetBSD: msg_240.c,v 1.5 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_240.c"
// Test for message: assignment of different structures (%s != %s) [240]
@@ -32,6 +32,7 @@ return_other_struct(struct s_arg s_arg)
void
assign_other_struct(struct s_arg s_arg)
{
+ /* expect+1: warning: 's_local' unused in function 'assign_other_struct' [192] */
static struct s_local s_local;
/* XXX: No warning? */
s_local = s_arg;
Index: src/tests/usr.bin/xlint/lint1/msg_169.c
diff -u src/tests/usr.bin/xlint/lint1/msg_169.c:1.7 src/tests/usr.bin/xlint/lint1/msg_169.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_169.c:1.7 Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_169.c Fri Jul 7 06:03:31 2023
@@ -1,9 +1,9 @@
-/* $NetBSD: msg_169.c,v 1.7 2023/03/28 14:44:35 rillig Exp $ */
+/* $NetBSD: msg_169.c,v 1.8 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_169.c"
// Test for message: precedence confusion possible: parenthesize! [169]
-/* lint1-flags: -g -h -S -w -X 351 */
+/* lint1-flags: -g -h -S -w -X 191,351 */
typedef _Bool bool;
Index: src/tests/usr.bin/xlint/lint1/msg_277.c
diff -u src/tests/usr.bin/xlint/lint1/msg_277.c:1.7 src/tests/usr.bin/xlint/lint1/msg_277.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_277.c:1.7 Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_277.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_277.c,v 1.7 2023/03/28 14:44:35 rillig Exp $ */
+/* $NetBSD: msg_277.c,v 1.8 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_277.c"
// Test for message: initialization of '%s' with '%s' [277]
@@ -27,7 +27,9 @@ example(enum E e, int i)
sink_int(i2);
sink_int(i3);
+ /* expect+1: warning: 'init_0' set but not used in function 'example' [191] */
enum E init_0 = 0;
+ /* expect+2: warning: 'init_1' set but not used in function 'example' [191] */
/* expect+1: warning: initialization of 'enum E' with 'int' [277] */
enum E init_1 = 1;
}
Index: src/tests/usr.bin/xlint/lint1/msg_324.c
diff -u src/tests/usr.bin/xlint/lint1/msg_324.c:1.7 src/tests/usr.bin/xlint/lint1/msg_324.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_324.c:1.7 Wed Jun 22 19:23:18 2022
+++ src/tests/usr.bin/xlint/lint1/msg_324.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_324.c,v 1.7 2022/06/22 19:23:18 rillig Exp $ */
+/* $NetBSD: msg_324.c,v 1.8 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_324.c"
// Test for message: suggest cast from '%s' to '%s' on op '%s' to avoid overflow [324]
@@ -22,10 +22,12 @@ example(char c, int i, unsigned u)
long long ll;
unsigned long long ull;
+ /* expect+2: warning: 'll' set but not used in function 'example' [191] */
/* expect+1: warning: suggest cast from 'int' to 'long long' on op '+' to avoid overflow [324] */
ll = c + i;
/* expect+1: warning: suggest cast from 'int' to 'long long' on op '-' to avoid overflow [324] */
ll = i - c;
+ /* expect+2: warning: 'ull' set but not used in function 'example' [191] */
/* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op '*' to avoid overflow [324] */
ull = c * u;
/* expect+1: warning: suggest cast from 'unsigned int' to 'unsigned long long' on op '+' to avoid overflow [324] */
Index: src/tests/usr.bin/xlint/lint1/msg_327.c
diff -u src/tests/usr.bin/xlint/lint1/msg_327.c:1.7 src/tests/usr.bin/xlint/lint1/msg_327.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_327.c:1.7 Tue Mar 28 14:44:35 2023
+++ src/tests/usr.bin/xlint/lint1/msg_327.c Fri Jul 7 06:03:31 2023
@@ -1,9 +1,9 @@
-/* $NetBSD: msg_327.c,v 1.7 2023/03/28 14:44:35 rillig Exp $ */
+/* $NetBSD: msg_327.c,v 1.8 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_327.c"
/* Test for message: declarations after statements is a C99 feature [327] */
-/* lint1-flags: -w -X 351 */
+/* lint1-flags: -w -X 192,351 */
void statement(void);
Index: src/tests/usr.bin/xlint/lint1/msg_247.c
diff -u src/tests/usr.bin/xlint/lint1/msg_247.c:1.30 src/tests/usr.bin/xlint/lint1/msg_247.c:1.31
--- src/tests/usr.bin/xlint/lint1/msg_247.c:1.30 Wed Jul 5 11:36:56 2023
+++ src/tests/usr.bin/xlint/lint1/msg_247.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_247.c,v 1.30 2023/07/05 11:36:56 rillig Exp $ */
+/* $NetBSD: msg_247.c,v 1.31 2023/07/07 06:03:31 rillig Exp $ */
# 3 "msg_247.c"
// Test for message: pointer cast from '%s' to '%s' may be troublesome [247]
@@ -308,6 +308,7 @@ void *
cast_between_first_member_struct(void *ptr)
{
/* Before tree.c 1.462 from 2022-06-24, lint warned about this cast. */
+ /* expect+1: warning: 't1' set but not used in function 'cast_between_first_member_struct' [191] */
void *t1 = (ctl_node_t *)(ctl_named_node_t *)ptr;
void *t2 = (ctl_named_node_t *)(ctl_node_t *)ptr;
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.341 src/usr.bin/xlint/lint1/decl.c:1.342
--- src/usr.bin/xlint/lint1/decl.c:1.341 Mon Jul 3 10:23:12 2023
+++ src/usr.bin/xlint/lint1/decl.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.341 2023/07/03 10:23:12 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.342 2023/07/07 06:03:31 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.341 2023/07/03 10:23:12 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.342 2023/07/07 06:03:31 rillig Exp $");
#endif
#include <sys/param.h>
@@ -2935,7 +2935,7 @@ check_variable_usage(bool novar, sym_t *
return;
/* errors in expressions easily cause lots of these warnings */
- if (nerr != 0)
+ if (seen_error)
return;
/*
Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.204 src/usr.bin/xlint/lint1/err.c:1.205
--- src/usr.bin/xlint/lint1/err.c:1.204 Sun Jul 2 23:40:23 2023
+++ src/usr.bin/xlint/lint1/err.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.204 2023/07/02 23:40:23 rillig Exp $ */
+/* $NetBSD: err.c,v 1.205 2023/07/07 06:03:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.204 2023/07/02 23:40:23 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.205 2023/07/07 06:03:31 rillig Exp $");
#endif
#include <limits.h>
@@ -47,8 +47,8 @@ __RCSID("$NetBSD: err.c,v 1.204 2023/07/
#include "lint1.h"
-/* number of errors found */
-int nerr;
+bool seen_error;
+bool seen_warning;
/* number of syntax errors */
int sytxerr;
@@ -529,7 +529,7 @@ verror_at(int msgid, const pos_t *pos, v
(void)printf("%s(%d): error: ", fn, pos->p_line);
(void)vprintf(msgs[msgid], ap);
(void)printf(" [%d]\n", msgid);
- nerr++;
+ seen_error = true;
print_stack_trace();
}
@@ -550,8 +550,7 @@ vwarning_at(int msgid, const pos_t *pos,
(void)printf("%s(%d): warning: ", fn, pos->p_line);
(void)vprintf(msgs[msgid], ap);
(void)printf(" [%d]\n", msgid);
- if (wflag)
- nerr++;
+ seen_warning = true;
print_stack_trace();
}
Index: src/usr.bin/xlint/lint1/externs1.h
diff -u src/usr.bin/xlint/lint1/externs1.h:1.188 src/usr.bin/xlint/lint1/externs1.h:1.189
--- src/usr.bin/xlint/lint1/externs1.h:1.188 Sun Jul 2 23:40:23 2023
+++ src/usr.bin/xlint/lint1/externs1.h Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: externs1.h,v 1.188 2023/07/02 23:40:23 rillig Exp $ */
+/* $NetBSD: externs1.h,v 1.189 2023/07/07 06:03:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -156,7 +156,8 @@ void debug_leave_func(const char *);
/*
* err.c
*/
-extern int nerr;
+extern bool seen_error;
+extern bool seen_warning;
extern int sytxerr;
extern bool any_query_enabled;
Index: src/usr.bin/xlint/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.71 src/usr.bin/xlint/lint1/main1.c:1.72
--- src/usr.bin/xlint/lint1/main1.c:1.71 Mon Jul 3 11:16:32 2023
+++ src/usr.bin/xlint/lint1/main1.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: main1.c,v 1.71 2023/07/03 11:16:32 rillig Exp $ */
+/* $NetBSD: main1.c,v 1.72 2023/07/07 06:03:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: main1.c,v 1.71 2023/07/03 11:16:32 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.72 2023/07/07 06:03:31 rillig Exp $");
#endif
#include <sys/types.h>
@@ -258,7 +258,7 @@ main(int argc, char *argv[])
outclose();
- return nerr != 0 ? 1 : 0;
+ return seen_error || (wflag && seen_warning) ? 1 : 0;
}
static void __attribute__((noreturn))
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.547 src/usr.bin/xlint/lint1/tree.c:1.548
--- src/usr.bin/xlint/lint1/tree.c:1.547 Mon Jul 3 21:36:16 2023
+++ src/usr.bin/xlint/lint1/tree.c Fri Jul 7 06:03:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.547 2023/07/03 21:36:16 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.548 2023/07/07 06:03:31 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.547 2023/07/03 21:36:16 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.548 2023/07/07 06:03:31 rillig Exp $");
#endif
#include <float.h>
@@ -4336,7 +4336,7 @@ integer_constant(tnode_t *tn, bool requi
val_t *v = xcalloc(1, sizeof(*v));
if (tn == NULL) {
- lint_assert(nerr != 0);
+ lint_assert(seen_error);
debug_step("constant node is null; returning 1 instead");
v->v_tspec = INT;
v->u.integer = 1;