Module Name: src Committed By: rillig Date: Sat Jan 21 20:07:02 UTC 2023
Modified Files: src/usr.bin/xlint/lint1: ckbool.c tree.c Log Message: lint: make code for strict bool mode more consistent Guard all entry points with a check for Tflag and remove the now redundant internal check for Tflag. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint1/ckbool.c cvs rdiff -u -r1.492 -r1.493 src/usr.bin/xlint/lint1/tree.c 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/ckbool.c diff -u src/usr.bin/xlint/lint1/ckbool.c:1.19 src/usr.bin/xlint/lint1/ckbool.c:1.20 --- src/usr.bin/xlint/lint1/ckbool.c:1.19 Wed Jun 22 19:23:17 2022 +++ src/usr.bin/xlint/lint1/ckbool.c Sat Jan 21 20:07:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ckbool.c,v 1.19 2022/06/22 19:23:17 rillig Exp $ */ +/* $NetBSD: ckbool.c,v 1.20 2023/01/21 20:07:01 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: ckbool.c,v 1.19 2022/06/22 19:23:17 rillig Exp $"); +__RCSID("$NetBSD: ckbool.c,v 1.20 2023/01/21 20:07:01 rillig Exp $"); #endif #include <string.h> @@ -217,8 +217,6 @@ is_typeok_bool_compares_with_zero(const { tspec_t t; - lint_assert(Tflag); - while (tn->tn_op == COMMA) tn = tn->tn_right; tn = before_conversion(tn); @@ -243,14 +241,14 @@ is_typeok_bool_compares_with_zero(const bool fallback_symbol_strict_bool(sym_t *sym) { - if (Tflag && strcmp(sym->s_name, "__lint_false") == 0) { + if (strcmp(sym->s_name, "__lint_false") == 0) { sym->s_scl = BOOL_CONST; sym->s_type = gettyp(BOOL); sym->u.s_bool_constant = false; return true; } - if (Tflag && strcmp(sym->s_name, "__lint_true") == 0) { + if (strcmp(sym->s_name, "__lint_true") == 0) { sym->s_scl = BOOL_CONST; sym->s_type = gettyp(BOOL); sym->u.s_bool_constant = true; Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.492 src/usr.bin/xlint/lint1/tree.c:1.493 --- src/usr.bin/xlint/lint1/tree.c:1.492 Sat Jan 14 10:33:34 2023 +++ src/usr.bin/xlint/lint1/tree.c Sat Jan 21 20:07:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.492 2023/01/14 10:33:34 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.493 2023/01/21 20:07:01 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.492 2023/01/14 10:33:34 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.493 2023/01/21 20:07:01 rillig Exp $"); #endif #include <float.h> @@ -388,7 +388,7 @@ static void fallback_symbol(sym_t *sym) { - if (fallback_symbol_strict_bool(sym)) + if (Tflag && fallback_symbol_strict_bool(sym)) return; if (block_level > 0 && (strcmp(sym->s_name, "__FUNCTION__") == 0 ||