Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/xlint lint: hide irrelevant type information f...



details:   https://anonhg.NetBSD.org/src/rev/8bc45ce5a03d
branches:  trunk
changeset: 1023394:8bc45ce5a03d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 05 18:17:15 2021 +0000

description:
lint: hide irrelevant type information from lint2

No functional change.

diffstat:

 tests/usr.bin/xlint/lint2/t_lint2.sh |   6 +++---
 usr.bin/xlint/common/inittyp.c       |  19 +++++++++++++++++--
 usr.bin/xlint/common/lint.h          |   6 +++++-
 usr.bin/xlint/lint2/externs2.h       |   5 +----
 usr.bin/xlint/lint2/main2.c          |  17 +++--------------
 usr.bin/xlint/xlint/xlint.c          |   6 ++----
 6 files changed, 31 insertions(+), 28 deletions(-)

diffs (245 lines):

diff -r d2e493b397fa -r 8bc45ce5a03d tests/usr.bin/xlint/lint2/t_lint2.sh
--- a/tests/usr.bin/xlint/lint2/t_lint2.sh      Sun Sep 05 17:49:55 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/t_lint2.sh      Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_lint2.sh,v 1.7 2021/09/04 20:39:17 rillig Exp $
+# $NetBSD: t_lint2.sh,v 1.8 2021/09/05 18:17:15 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -43,7 +43,7 @@
            > "$1.ln"
 
        atf_check -o "file:$srcdir/$1.exp" \
-           "$lint2" -h -p -x "$1.ln"
+           "$lint2" -h -x "$1.ln"
 }
 
 std_emit_body()
@@ -60,7 +60,7 @@
            > "$1.exp-ln"
 
        atf_check \
-           "$lint2" -h -p -x -C "$1" "$1.ln"
+           "$lint2" -h -x -C "$1" "$1.ln"
 
        atf_check -o "file:$1.exp-ln" \
            cat "llib-l$1.ln"
diff -r d2e493b397fa -r 8bc45ce5a03d usr.bin/xlint/common/inittyp.c
--- a/usr.bin/xlint/common/inittyp.c    Sun Sep 05 17:49:55 2021 +0000
+++ b/usr.bin/xlint/common/inittyp.c    Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $      */
+/*     $NetBSD: inittyp.c,v 1.30 2021/09/05 18:17:15 rillig Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.29 2021/09/04 15:39:41 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.30 2021/09/05 18:17:15 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -48,6 +48,7 @@
 
 #define INT_RSIZE      (/*CONSTCOND*/INTPTR_TSPEC == LONG ? 3 : 4)
 
+#ifdef IS_LINT1
 #define typeinfo( \
            name, signed_type, unsigned_type, \
            size_in_bits, portable_size_in_bits, \
@@ -60,6 +61,18 @@
                (is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \
                name, \
        }
+#else
+#define typeinfo( \
+           name, signed_type, unsigned_type, \
+           size_in_bits, portable_size_in_bits, \
+           is_integer, is_unsigned, is_floating, is_arithmetic, \
+           is_scalar, is_complex) \
+       { \
+               signed_type, unsigned_type, \
+               (is_integer) > 0, \
+               name, \
+       }
+#endif
 
 /* various type information */
 ttab_t ttab[NTSPEC] = {
@@ -121,6 +134,7 @@
 };
 #undef typeinfo
 
+#ifdef IS_LINT1
 void
 inittyp(void)
 {
@@ -138,3 +152,4 @@
                ttab[BOOL].tt_is_arithmetic = false;
        }
 }
+#endif
diff -r d2e493b397fa -r 8bc45ce5a03d usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Sun Sep 05 17:49:55 2021 +0000
+++ b/usr.bin/xlint/common/lint.h       Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lint.h,v 1.31 2021/08/29 09:29:32 rillig Exp $ */
+/*     $NetBSD: lint.h,v 1.32 2021/09/05 18:17:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -92,17 +92,21 @@
  * size of types, name and classification
  */
 typedef        struct {
+#ifdef IS_LINT1
        unsigned int tt_size_in_bits;
        unsigned int tt_portable_size_in_bits; /* different from
                                         * tt_size_in_bits if pflag is set */
+#endif
        tspec_t tt_signed_counterpart;
        tspec_t tt_unsigned_counterpart;
        bool    tt_is_integer : 1;      /* integer type */
+#ifdef IS_LINT1
        bool    tt_is_uinteger : 1;     /* unsigned integer type */
        bool    tt_is_floating : 1;     /* floating point type */
        bool    tt_is_arithmetic : 1;   /* arithmetic type */
        bool    tt_is_scalar : 1;       /* scalar type */
        bool    tt_is_complex : 1;      /* complex type */
+#endif
        const char *tt_name;            /* name of the type */
 } ttab_t;
 
diff -r d2e493b397fa -r 8bc45ce5a03d usr.bin/xlint/lint2/externs2.h
--- a/usr.bin/xlint/lint2/externs2.h    Sun Sep 05 17:49:55 2021 +0000
+++ b/usr.bin/xlint/lint2/externs2.h    Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs2.h,v 1.14 2021/08/28 17:18:42 rillig Exp $ */
+/* $NetBSD: externs2.h,v 1.15 2021/09/05 18:17:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -44,8 +44,6 @@
 extern bool    Hflag;
 extern bool    hflag;
 extern bool    Fflag;
-extern bool    pflag;
-extern bool    Tflag;
 
 /*
  * hash.c
@@ -77,7 +75,6 @@
 /*
  * chk.c
  */
-extern void    inittyp(void);
 extern void    mainused(void);
 extern void    chkname(const hte_t *);
 
diff -r d2e493b397fa -r 8bc45ce5a03d usr.bin/xlint/lint2/main2.c
--- a/usr.bin/xlint/lint2/main2.c       Sun Sep 05 17:49:55 2021 +0000
+++ b/usr.bin/xlint/lint2/main2.c       Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $        */
+/*     $NetBSD: main2.c,v 1.22 2021/09/05 18:17:15 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.21 2021/08/28 19:49:28 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.22 2021/09/05 18:17:15 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -60,15 +60,12 @@
 bool   Cflag;
 const char *libname;
 
-bool   pflag;
-
 /*
  * warnings for (tentative) definitions of the same name in more than
  * one translation unit
  */
 bool   sflag;
 
-bool   Tflag;
 bool   tflag;
 
 /*
@@ -107,14 +104,11 @@
        libs = xcalloc(1, sizeof(*libs));
 
        opterr = 0;
-       while ((c = getopt(argc, argv, "hpstxuC:HTFl:")) != -1) {
+       while ((c = getopt(argc, argv, "hstxuC:HFl:")) != -1) {
                switch (c) {
                case 's':
                        sflag = true;
                        break;
-               case 'T':
-                       Tflag = true;
-                       break;
                case 't':
                        tflag = true;
                        break;
@@ -124,9 +118,6 @@
                case 'x':
                        xflag = true;
                        break;
-               case 'p':
-                       pflag = true;
-                       break;
                case 'C':
                        len = strlen(optarg);
                        lname = xmalloc(len + 10);
@@ -167,8 +158,6 @@
        /* initialize hash table */
        inithash();
 
-       inittyp();
-
        for (i = 0; i < argc; i++)
                readfile(argv[i]);
 
diff -r d2e493b397fa -r 8bc45ce5a03d usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Sun Sep 05 17:49:55 2021 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Sun Sep 05 18:17:15 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.81 2021/09/05 16:15:05 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.82 2021/09/05 18:17:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: xlint.c,v 1.81 2021/09/05 16:15:05 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.82 2021/09/05 18:17:15 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -430,7 +430,6 @@
                                list_add_copy(&deflibs, "c");
                        }
                        pass_flag_to_lint1(c);
-                       pass_flag_to_lint2(c);
                        break;
 
                case 's':
@@ -455,7 +454,6 @@
                case 'T':
                        pass_to_cpp("-I" PATH_STRICT_BOOL_INCLUDE);
                        pass_flag_to_lint1(c);
-                       pass_flag_to_lint2(c);
                        break;
 
 #if !HAVE_NBTOOL_CONFIG_H



Home | Main Index | Thread Index | Old Index