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

No functional change.
This commit is contained in:
rillig 2021-08-22 15:06:49 +00:00
parent e0b51e94e0
commit f7d8392a80
6 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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 *, ...) __printflike(1, 2);
/*
* 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

View File

@ -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 {

View File

@ -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

View File

@ -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.c chk.c msg.c emit.c emit2.c \
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 :}

View File

@ -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}