Module Name: src
Committed By: rillig
Date: Sun Aug 22 15:06:49 UTC 2021
Modified Files:
src/usr.bin/xlint/common: emit.c externs.h lint.h mem.c
src/usr.bin/xlint/lint2: Makefile
src/usr.bin/xlint/xlint: Makefile
Log Message:
lint: only include code in the binaries that is actually used
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/common/emit.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/common/mem.c
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint2/Makefile
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/xlint/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/common/emit.c
diff -u src/usr.bin/xlint/common/emit.c:1.12 src/usr.bin/xlint/common/emit.c:1.13
--- src/usr.bin/xlint/common/emit.c:1.12 Tue Aug 3 17:44:58 2021
+++ src/usr.bin/xlint/common/emit.c Sun Aug 22 15:06:49 2021
@@ -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 @@ outchar(int c)
*ob.o_next++ = (char)c;
}
+#if defined(IS_LINT1)
/*
* write a character to the output buffer, quoted if necessary
*/
@@ -181,6 +182,7 @@ outqchar(int c)
}
}
}
+#endif
/*
* write a string to the output buffer
Index: src/usr.bin/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.19 src/usr.bin/xlint/common/externs.h:1.20
--- src/usr.bin/xlint/common/externs.h:1.19 Sun Aug 22 14:50:06 2021
+++ src/usr.bin/xlint/common/externs.h Sun Aug 22 15:06:49 2021
@@ -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 @@ extern char *xasprintf(const char *, ..
/*
* emit.c
*/
+#if defined(IS_LINT1) || defined(IS_LINT2)
extern ob_t ob;
extern void outopen(const char *);
@@ -66,3 +67,4 @@ extern void outint(int);
#define outname(a) outname1(__FILE__, __LINE__, a);
extern void outname1(const char *, size_t, const char *);
extern void outsrc(const char *);
+#endif
Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.28 src/usr.bin/xlint/common/lint.h:1.29
--- src/usr.bin/xlint/common/lint.h:1.28 Tue Aug 10 17:31:44 2021
+++ src/usr.bin/xlint/common/lint.h Sun Aug 22 15:06:49 2021
@@ -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 @@ typedef struct {
#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 {
Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.16 src/usr.bin/xlint/common/mem.c:1.17
--- src/usr.bin/xlint/common/mem.c:1.16 Tue Aug 3 17:20:02 2021
+++ src/usr.bin/xlint/common/mem.c Sun Aug 22 15:06:49 2021
@@ -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 @@ xstrdup(const char *s)
return not_null(strdup(s));
}
+#if defined(IS_XLINT)
char *
xasprintf(const char *fmt, ...)
{
@@ -97,3 +98,4 @@ xasprintf(const char *fmt, ...)
not_null(NULL);
return str;
}
+#endif
Index: src/usr.bin/xlint/lint2/Makefile
diff -u src/usr.bin/xlint/lint2/Makefile:1.21 src/usr.bin/xlint/lint2/Makefile:1.22
--- src/usr.bin/xlint/lint2/Makefile:1.21 Sun Aug 8 11:56:35 2021
+++ src/usr.bin/xlint/lint2/Makefile Sun Aug 22 15:06:49 2021
@@ -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 @@ SRCS= main2.c hash.c read.c mem.c mem2.
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 :}
Index: src/usr.bin/xlint/xlint/Makefile
diff -u src/usr.bin/xlint/xlint/Makefile:1.21 src/usr.bin/xlint/xlint/Makefile:1.22
--- src/usr.bin/xlint/xlint/Makefile:1.21 Sun Aug 22 14:35:44 2021
+++ src/usr.bin/xlint/xlint/Makefile Sun Aug 22 15:06:49 2021
@@ -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 @@ MAN= lint.1
CPPFLAGS+= -I${.CURDIR}/../lint1
CPPFLAGS+= -I${.CURDIR}/../../mkdep
+CPPFLAGS+= -DIS_XLINT
.if (${HOSTPROG:U} == "")
DPADD+= ${LIBUTIL}