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: only include code in the binaries that i...



details:   https://anonhg.NetBSD.org/src/rev/d806422f3566
branches:  trunk
changeset: 1023076:d806422f3566
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 22 15:06:49 2021 +0000

description:
lint: only include code in the binaries that is actually used

No functional change.

diffstat:

 usr.bin/xlint/common/emit.c    |  6 ++++--
 usr.bin/xlint/common/externs.h |  4 +++-
 usr.bin/xlint/common/lint.h    |  4 +++-
 usr.bin/xlint/common/mem.c     |  6 ++++--
 usr.bin/xlint/lint2/Makefile   |  3 ++-
 usr.bin/xlint/xlint/Makefile   |  3 ++-
 6 files changed, 18 insertions(+), 8 deletions(-)

diffs (140 lines):

diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/common/emit.c
--- a/usr.bin/xlint/common/emit.c       Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/common/emit.c       Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emit.c,v 1.12 2021/08/03 17:44:58 rillig Exp $ */
+/*     $NetBSD: emit.c,v 1.13 2021/08/22 15:06:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit.c,v 1.12 2021/08/03 17:44:58 rillig Exp $");
+__RCSID("$NetBSD: emit.c,v 1.13 2021/08/22 15:06:49 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -131,6 +131,7 @@
        *ob.o_next++ = (char)c;
 }
 
+#if defined(IS_LINT1)
 /*
  * write a character to the output buffer, quoted if necessary
  */
@@ -181,6 +182,7 @@
                }
        }
 }
+#endif
 
 /*
  * write a string to the output buffer
diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/common/externs.h
--- a/usr.bin/xlint/common/externs.h    Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/common/externs.h    Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: externs.h,v 1.19 2021/08/22 14:50:06 rillig Exp $      */
+/*     $NetBSD: externs.h,v 1.20 2021/08/22 15:06:49 rillig Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -54,6 +54,7 @@
 /*
  * emit.c
  */
+#if defined(IS_LINT1) || defined(IS_LINT2)
 extern ob_t    ob;
 
 extern void    outopen(const char *);
@@ -66,3 +67,4 @@
 #define outname(a)     outname1(__FILE__, __LINE__, a);
 extern void    outname1(const char *, size_t, const char *);
 extern void    outsrc(const char *);
+#endif
diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/common/lint.h       Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lint.h,v 1.28 2021/08/10 17:31:44 rillig Exp $ */
+/*     $NetBSD: lint.h,v 1.29 2021/08/22 15:06:49 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -117,7 +117,9 @@
 #define is_complex(t)          (ttab[t].tt_is_complex)
 #define is_scalar(t)           (ttab[t].tt_is_scalar)
 
+#if defined(IS_LINT1) || defined(IS_LINT2)
 extern ttab_t  ttab[];
+#endif
 
 
 typedef        enum {
diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/common/mem.c
--- a/usr.bin/xlint/common/mem.c        Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/common/mem.c        Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.16 2021/08/03 17:20:02 rillig Exp $  */
+/*     $NetBSD: mem.c,v 1.17 2021/08/22 15:06:49 rillig Exp $  */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem.c,v 1.16 2021/08/03 17:20:02 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.17 2021/08/22 15:06:49 rillig Exp $");
 #endif
 
 #include <stdarg.h>
@@ -83,6 +83,7 @@
        return not_null(strdup(s));
 }
 
+#if defined(IS_XLINT)
 char *
 xasprintf(const char *fmt, ...)
 {
@@ -97,3 +98,4 @@
                not_null(NULL);
        return str;
 }
+#endif
diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/lint2/Makefile
--- a/usr.bin/xlint/lint2/Makefile      Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/lint2/Makefile      Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.21 2021/08/08 11:56:35 rillig Exp $
+#      $NetBSD: Makefile,v 1.22 2021/08/22 15:06:49 rillig Exp $
 
 NOMAN=         # defined
 
@@ -7,6 +7,7 @@
                inittyp.c tyname.c
 BINDIR=                /usr/libexec
 CPPFLAGS+=     -I${.CURDIR}
+CPPFLAGS+=     -DIS_LINT2
 LINTFLAGS+=    -T              # strict bool mode
 
 COPTS.msg.c+=  ${${ACTIVE_CC} == "clang":? -Wno-format-nonliteral :}
diff -r 7d97b8bb5e13 -r d806422f3566 usr.bin/xlint/xlint/Makefile
--- a/usr.bin/xlint/xlint/Makefile      Sun Aug 22 14:50:06 2021 +0000
+++ b/usr.bin/xlint/xlint/Makefile      Sun Aug 22 15:06:49 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.21 2021/08/22 14:35:44 rillig Exp $
+#      $NetBSD: Makefile,v 1.22 2021/08/22 15:06:49 rillig Exp $
 
 .PATH:         ${.CURDIR}/../../mkdep
 
@@ -9,6 +9,7 @@
 
 CPPFLAGS+=     -I${.CURDIR}/../lint1
 CPPFLAGS+=     -I${.CURDIR}/../../mkdep
+CPPFLAGS+=     -DIS_XLINT
 
 .if (${HOSTPROG:U} == "")
 DPADD+=                ${LIBUTIL}



Home | Main Index | Thread Index | Old Index