summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-07-07 06:03:31 +0000
committerrillig <rillig@NetBSD.org>2023-07-07 06:03:31 +0000
commitf260bdb92f361d3b4e3ab9d23e5f0eb4faafd698 (patch)
treeab7115a0d2c19d8f3c540e8afc852a7403b759f7 /tests/usr.bin/xlint/lint1/gcc_attribute_var.c
parenteed2e1f5f354b83b1e2723c0412ffdf22f00d4e8 (diff)
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.
Diffstat (limited to 'tests/usr.bin/xlint/lint1/gcc_attribute_var.c')
-rw-r--r--tests/usr.bin/xlint/lint1/gcc_attribute_var.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/usr.bin/xlint/lint1/gcc_attribute_var.c b/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
index 7e9c09a6b98..eb97162d3b8 100644
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_var.c
@@ -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) {