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: rename parameter to expr



details:   https://anonhg.NetBSD.org/src/rev/59f5d3d54c17
branches:  trunk
changeset: 961790:59f5d3d54c17
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Apr 18 17:54:33 2021 +0000

description:
lint: rename parameter to expr

That parameter used to be used for a single purpose, later it got used
for checking the reachability as well, which made the name misleading.

diffstat:

 usr.bin/xlint/lint1/tree.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 5a6e0bb31a4c -r 59f5d3d54c17 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Apr 18 17:47:32 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Apr 18 17:54:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.279 2021/04/18 17:47:32 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.280 2021/04/18 17:54:33 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.279 2021/04/18 17:47:32 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.280 2021/04/18 17:54:33 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3604,7 +3604,7 @@
  * memory which is used for the expression.
  */
 void
-expr(tnode_t *tn, bool vctx, bool tctx, bool dofreeblk, bool constcond_false_ok)
+expr(tnode_t *tn, bool vctx, bool tctx, bool dofreeblk, bool is_do_while)
 {
 
        lint_assert(tn != NULL || nerr != 0);
@@ -3615,8 +3615,7 @@
        }
 
        /* expr() is also called in global initializations */
-       /* TODO: rename constcond_false_ok */
-       if (dcs->d_ctx != EXTERN && !constcond_false_ok)
+       if (dcs->d_ctx != EXTERN && !is_do_while)
                check_statement_reachable();
 
        check_expr_misc(tn, vctx, tctx, !tctx, false, false, false);
@@ -3627,7 +3626,7 @@
        } else if (tn->tn_op == CON) {
                if (hflag && tctx && !constcond_flag &&
                    !tn->tn_system_dependent &&
-                   !(constcond_false_ok &&
+                   !(is_do_while &&
                      is_constcond_false(tn, tn->tn_type->t_tspec)))
                        /* constant in conditional context */
                        warning(161);



Home | Main Index | Thread Index | Old Index