Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint lint: invert the -u, -v and -z flags



details:   https://anonhg.NetBSD.org/src/rev/aba06e26a539
branches:  trunk
changeset: 377248:aba06e26a539
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 03 10:23:12 2023 +0000

description:
lint: invert the -u, -v and -z flags

Now they behave the same as in the manual page.

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c  |   8 ++++----
 usr.bin/xlint/lint1/func.c  |   6 +++---
 usr.bin/xlint/lint1/main1.c |  16 ++++++++--------
 usr.bin/xlint/lint2/chk.c   |   6 +++---
 usr.bin/xlint/lint2/main2.c |  14 +++++---------
 5 files changed, 23 insertions(+), 27 deletions(-)

diffs (187 lines):

diff -r b5ab17b6f057 -r aba06e26a539 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon Jul 03 10:14:31 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon Jul 03 10:23:12 2023 +0000
@@ -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 *
        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 -r b5ab17b6f057 -r aba06e26a539 usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Mon Jul 03 10:14:31 2023 +0000
+++ b/usr.bin/xlint/lint1/func.c        Mon Jul 03 10:23:12 2023 +0000
@@ -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 -r b5ab17b6f057 -r aba06e26a539 usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c       Mon Jul 03 10:14:31 2023 +0000
+++ b/usr.bin/xlint/lint1/main1.c       Mon Jul 03 10:23:12 2023 +0000
@@ -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 -r b5ab17b6f057 -r aba06e26a539 usr.bin/xlint/lint2/chk.c
--- a/usr.bin/xlint/lint2/chk.c Mon Jul 03 10:14:31 2023 +0000
+++ b/usr.bin/xlint/lint2/chk.c Mon Jul 03 10:23:12 2023 +0000
@@ -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 -r b5ab17b6f057 -r aba06e26a539 usr.bin/xlint/lint2/main2.c
--- a/usr.bin/xlint/lint2/main2.c       Mon Jul 03 10:14:31 2023 +0000
+++ b/usr.bin/xlint/lint2/main2.c       Mon Jul 03 10:23:12 2023 +0000
@@ -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 @@
 /* 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;



Home | Main Index | Thread Index | Old Index