summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-07-03 10:23:12 +0000
committerrillig <rillig@NetBSD.org>2023-07-03 10:23:12 +0000
commit52834b01025b5c70d34c6b660c60be891df535ac (patch)
tree6a90d835b9a0b948af61a8f94cd04bbc6491971b /usr.bin
parent6f9b7795090406af5eb40ffeef54987e595b4463 (diff)
lint: invert the -u, -v and -z flags
Now they behave the same as in the manual page. No functional change.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/xlint/lint1/decl.c8
-rw-r--r--usr.bin/xlint/lint1/func.c6
-rw-r--r--usr.bin/xlint/lint1/main1.c16
-rw-r--r--usr.bin/xlint/lint2/chk.c6
-rw-r--r--usr.bin/xlint/lint2/main2.c14
5 files changed, 23 insertions, 27 deletions
diff --git a/usr.bin/xlint/lint1/decl.c b/usr.bin/xlint/lint1/decl.c
index 926f45db5a7..55fbb025402 100644
--- a/usr.bin/xlint/lint1/decl.c
+++ b/usr.bin/xlint/lint1/decl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.340 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.341 2023/07/03 10:23: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: decl.c,v 1.340 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.341 2023/07/03 10:23:12 rillig Exp $");
#endif
#include <sys/param.h>
@@ -2918,7 +2918,7 @@ check_argument_usage(bool novar, sym_t *arg)
if (novar)
return;
- if (!arg->s_used && vflag) {
+ if (!arg->s_used && !vflag) {
/* argument '%s' unused in function '%s' */
warning_at(231, &arg->s_def_pos, arg->s_name, funcsym->s_name);
}
@@ -3018,7 +3018,7 @@ check_tag_usage(sym_t *sym)
return;
/* always complain about incomplete tags declared inside blocks */
- if (!zflag || dcs->d_kind != DLK_EXTERN)
+ if (zflag || dcs->d_kind != DLK_EXTERN)
return;
switch (sym->s_type->t_tspec) {
diff --git a/usr.bin/xlint/lint1/func.c b/usr.bin/xlint/lint1/func.c
index 3f4f58feb11..9cb3494fa13 100644
--- a/usr.bin/xlint/lint1/func.c
+++ b/usr.bin/xlint/lint1/func.c
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.164 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: func.c,v 1.165 2023/07/03 10:23:12 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: func.c,v 1.164 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.165 2023/07/03 10:23:12 rillig Exp $");
#endif
#include <stdlib.h>
@@ -1283,7 +1283,7 @@ lintlib(int n)
return;
}
llibflg = true;
- vflag = false;
+ vflag = true;
}
/* Suppress one or most warnings at the current and the following line. */
diff --git a/usr.bin/xlint/lint1/main1.c b/usr.bin/xlint/lint1/main1.c
index f2ba702b492..179408ec839 100644
--- a/usr.bin/xlint/lint1/main1.c
+++ b/usr.bin/xlint/lint1/main1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main1.c,v 1.69 2023/07/03 10:14:31 rillig Exp $ */
+/* $NetBSD: main1.c,v 1.70 2023/07/03 10:23:12 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.69 2023/07/03 10:14:31 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.70 2023/07/03 10:23:12 rillig Exp $");
#endif
#include <sys/types.h>
@@ -59,11 +59,11 @@ bool Pflag;
bool pflag;
bool rflag;
bool Tflag;
-bool uflag = true;
-bool vflag = true;
+bool uflag;
+bool vflag;
bool wflag;
bool yflag;
-bool zflag = true;
+bool zflag;
/*
* The default language level is the one that checks for compatibility
@@ -171,11 +171,11 @@ main(int argc, char *argv[])
allow_c11 = false;
allow_c23 = false;
break;
- case 'u': uflag = false; break;
+ case 'u': uflag = true; break;
case 'w': wflag = true; break;
- case 'v': vflag = false; break;
+ case 'v': vflag = true; break;
case 'y': yflag = true; break;
- case 'z': zflag = false; break;
+ case 'z': zflag = true; break;
case 'A':
if (strcmp(optarg, "c23") == 0) {
diff --git a/usr.bin/xlint/lint2/chk.c b/usr.bin/xlint/lint2/chk.c
index 2544b0d6ea1..0485e468882 100644
--- a/usr.bin/xlint/lint2/chk.c
+++ b/usr.bin/xlint/lint2/chk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.56 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.57 2023/07/03 10:23: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: chk.c,v 1.56 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.57 2023/07/03 10:23:12 rillig Exp $");
#endif
#include <ctype.h>
@@ -90,7 +90,7 @@ check_name(const hte_t *hte)
{
sym_t *sym, *def, *pdecl, *decl;
- if (uflag) {
+ if (!uflag) {
check_used_not_defined(hte);
check_defined_not_used(hte);
if (xflag)
diff --git a/usr.bin/xlint/lint2/main2.c b/usr.bin/xlint/lint2/main2.c
index 8839a27495a..9573f1ad520 100644
--- a/usr.bin/xlint/lint2/main2.c
+++ b/usr.bin/xlint/lint2/main2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main2.c,v 1.29 2023/06/09 13:03:49 rillig Exp $ */
+/* $NetBSD: main2.c,v 1.30 2023/07/03 10:23:12 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: main2.c,v 1.29 2023/06/09 13:03:49 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.30 2023/07/03 10:23:12 rillig Exp $");
#endif
#include <stdio.h>
@@ -50,11 +50,7 @@ __RCSID("$NetBSD: main2.c,v 1.29 2023/06/09 13:03:49 rillig Exp $");
/* warnings for symbols which are declared but not defined or used */
bool xflag;
-/*
- * warnings for symbols which are used and not defined or defined
- * and not used
- */
-bool uflag = true;
+bool uflag;
/* Create a lint library in the current directory with name libname. */
bool Cflag;
@@ -113,7 +109,7 @@ main(int argc, char *argv[])
tflag = true;
break;
case 'u':
- uflag = false;
+ uflag = true;
break;
case 'x':
xflag = true;
@@ -124,7 +120,7 @@ main(int argc, char *argv[])
(void)sprintf(lname, "llib-l%s.ln", optarg);
libname = lname;
Cflag = true;
- uflag = false;
+ uflag = true;
break;
case 'H':
Hflag = true;