Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: make code for strict bool mode mor...



details:   https://anonhg.NetBSD.org/src/rev/0bb3059814c1
branches:  trunk
changeset: 373155:0bb3059814c1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 21 20:07:01 2023 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/ckbool.c |  10 ++++------
 usr.bin/xlint/lint1/tree.c   |   6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (71 lines):

diff -r 305a72ba8ed5 -r 0bb3059814c1 usr.bin/xlint/lint1/ckbool.c
--- a/usr.bin/xlint/lint1/ckbool.c      Sat Jan 21 18:03:37 2023 +0000
+++ b/usr.bin/xlint/lint1/ckbool.c      Sat Jan 21 20:07:01 2023 +0000
@@ -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 @@
 {
        tspec_t t;
 
-       lint_assert(Tflag);
-
        while (tn->tn_op == COMMA)
                tn = tn->tn_right;
        tn = before_conversion(tn);
@@ -243,14 +241,14 @@
 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;
diff -r 305a72ba8ed5 -r 0bb3059814c1 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sat Jan 21 18:03:37 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sat Jan 21 20:07:01 2023 +0000
@@ -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 @@
 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 ||



Home | Main Index | Thread Index | Old Index