summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-07-08 11:18:16 +0000
committerrillig <rillig@NetBSD.org>2023-07-08 11:18:16 +0000
commit0cb694ff0db3cc034bb89146a9f647760c5b961d (patch)
treefc1fcd93c3f80132fce341d56d486d632fae76ba
parent5880b286cc99d7de8243d645f790dfd2abc8af94 (diff)
lint: enable more lint warnings for its own source code
-rw-r--r--usr.bin/xlint/Makefile.inc5
-rw-r--r--usr.bin/xlint/lint1/Makefile3
-rw-r--r--usr.bin/xlint/lint2/read.c8
3 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/xlint/Makefile.inc b/usr.bin/xlint/Makefile.inc
index f6e70f861de..3a983974260 100644
--- a/usr.bin/xlint/Makefile.inc
+++ b/usr.bin/xlint/Makefile.inc
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.23 2022/04/10 13:21:34 martin Exp $
+# $NetBSD: Makefile.inc,v 1.24 2023/07/08 11:18:16 rillig Exp $
.include <bsd.own.mk>
@@ -27,4 +27,7 @@ CFLAGS+= ${ACTIVE_CC:Mgcc:%=-ftrapv}
.include "${.CURDIR}/../../Makefile.inc"
.endif
+LINTFLAGS+= -aa # warn about all lossy conversions
+LINTFLAGS+= -e # strict enum mode
+LINTFLAGS+= -T # strict bool mode
LINTFLAGS+= -w # treat warnings as errors
diff --git a/usr.bin/xlint/lint1/Makefile b/usr.bin/xlint/lint1/Makefile
index 57bb46816d4..2f958fd7328 100644
--- a/usr.bin/xlint/lint1/Makefile
+++ b/usr.bin/xlint/lint1/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.96 2023/07/05 11:42:14 rillig Exp $
+# $NetBSD: Makefile,v 1.97 2023/07/08 11:18:16 rillig Exp $
.include <bsd.own.mk>
@@ -16,7 +16,6 @@ YHEADER=
#LFLAGS+= -d
CWARNFLAGS.clang+= -Wno-error=implicit-int-float-conversion
-LINTFLAGS+= -T
LOBJS.${PROG}+= ${SRCS:M*.y:.y=.ln}
LOBJS.${PROG}+= ${SRCS:M*.l:.l=.ln}
LINTFLAGS.cgram.c+= -X 351 # 'extern' declaration in .c file
diff --git a/usr.bin/xlint/lint2/read.c b/usr.bin/xlint/lint2/read.c
index 5554cd3b322..c0fe100d567 100644
--- a/usr.bin/xlint/lint2/read.c
+++ b/usr.bin/xlint/lint2/read.c
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.82 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: read.c,v 1.83 2023/07/08 11:18:16 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: read.c,v 1.82 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.83 2023/07/08 11:18:16 rillig Exp $");
#endif
#include <ctype.h>
@@ -732,7 +732,7 @@ inptype(const char *cp, const char **epp)
tp->t_uniqpos.p_line = parse_int(&cp);
cp++;
/* xlate to 'global' file name. */
- tp->t_uniqpos.p_file =
+ tp->t_uniqpos.p_file = (short)
addoutfile(inpfns[parse_int(&cp)]);
cp++;
tp->t_uniqpos.p_uniq = parse_int(&cp);
@@ -973,7 +973,7 @@ storetyp(type_t *tp, const char *cp, size_t len, int h)
thte = xalloc(sizeof(*thte));
thte->th_name = name;
- thte->th_idx = tidx;
+ thte->th_idx = (unsigned short)tidx;
thte->th_next = thtab[h];
thtab[h] = thte;