Module Name: src Committed By: rillig Date: Sun Apr 18 21:53:37 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: Makefile cgram.y Log Message: lint: fix strict bool mode errors in cgram.y The code generated by yacc already adheres to strict bool mode, in default mode as well as in debug mode. Running lint on the generated cgram.c as well avoids most of the "declared but not used" warnings from lint2. The code generated by lex does not adhere to strict bool mode though. Suppressing the errors from strict bool mode works, but then lint1 runs into an assertion failure: assertion "tn != NULL || nerr != 0" failed in expr at tree.c:3610 near scan.c:822 This leaves several warnings about "declared but not used" for the functions from lex.c. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.218 -r1.219 src/usr.bin/xlint/lint1/cgram.y 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/lint1/Makefile diff -u src/usr.bin/xlint/lint1/Makefile:1.68 src/usr.bin/xlint/lint1/Makefile:1.69 --- src/usr.bin/xlint/lint1/Makefile:1.68 Sat Apr 17 11:01:34 2021 +++ src/usr.bin/xlint/lint1/Makefile Sun Apr 18 21:53:37 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.68 2021/04/17 11:01:34 rillig Exp $ +# $NetBSD: Makefile,v 1.69 2021/04/18 21:53:37 rillig Exp $ .include <bsd.own.mk> @@ -10,13 +10,16 @@ SRCS= cgram.y \ MAN= lint.7 YHEADER= -#DBG=-g -#CPPFLAGS+=-DYYDEBUG=1 -#YFLAGS+=-v -#LFLAGS+=-d +#DBG= -g +#CPPFLAGS+= -DYYDEBUG=1 +#YFLAGS+= -v +#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.scan.c= -X 107,330,331,333 CPPFLAGS+= -DIS_LINT1 CPPFLAGS+= -I${.CURDIR} Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.218 src/usr.bin/xlint/lint1/cgram.y:1.219 --- src/usr.bin/xlint/lint1/cgram.y:1.218 Wed Apr 14 22:08:28 2021 +++ src/usr.bin/xlint/lint1/cgram.y Sun Apr 18 21:53:37 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.218 2021/04/14 22:08:28 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.219 2021/04/18 21:53:37 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: cgram.y,v 1.218 2021/04/14 22:08:28 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.219 2021/04/18 21:53:37 rillig Exp $"); #endif #include <limits.h> @@ -118,7 +118,7 @@ RESTORE_WARN_FLAGS(const char *file, siz static void anonymize(sym_t *s) { - for ( ; s; s = s->s_next) + for ( ; s != NULL; s = s->s_next) s->s_styp = NULL; } %} @@ -138,7 +138,7 @@ anonymize(sym_t *s) range_t y_range; strg_t *y_string; pqinf_t *y_pqinf; - int y_seen_statement; + bool y_seen_statement; }; %token T_LBRACE T_RBRACE T_LBRACK T_RBRACK T_LPAREN T_RPAREN @@ -2145,7 +2145,7 @@ ignore_up_to_rparen(void) static sym_t * symbolrename(sym_t *s, sbuf_t *sb) { - if (sb) + if (sb != NULL) s->s_rename = sb->sb_name; return s; }