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 is_nonzero to constant_is_n...



details:   https://anonhg.NetBSD.org/src/rev/635d2c08d4ac
branches:  trunk
changeset: 959907:635d2c08d4ac
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 28 19:16:05 2021 +0000

description:
lint: rename is_nonzero to constant_is_nonzero

The new function name emphasizes that the given node must have the
operator CON.

No functional change.

diffstat:

 usr.bin/xlint/lint1/func.c  |  10 +++++-----
 usr.bin/xlint/lint1/lint1.h |   4 ++--
 usr.bin/xlint/lint1/tree.c  |   8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

diffs (92 lines):

diff -r 1d0bd4158fc5 -r 635d2c08d4ac usr.bin/xlint/lint1/func.c
--- a/usr.bin/xlint/lint1/func.c        Sun Feb 28 19:01:11 2021 +0000
+++ b/usr.bin/xlint/lint1/func.c        Sun Feb 28 19:16:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: func.c,v 1.73 2021/02/22 15:09:50 rillig Exp $ */
+/*     $NetBSD: func.c,v 1.74 2021/02/28 19:16:05 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.73 2021/02/22 15:09:50 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.74 2021/02/28 19:16:05 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -740,7 +740,7 @@
        pushctrl(T_WHILE);
        cstmt->c_loop = true;
        if (tn != NULL && tn->tn_op == CON)
-               cstmt->c_infinite = is_nonzero(tn);
+               cstmt->c_infinite = constant_is_nonzero(tn);
 
        check_getopt_begin_while(tn);
        expr(tn, false, true, true, false);
@@ -801,7 +801,7 @@
                tn = check_controlling_expression(tn);
 
        if (tn != NULL && tn->tn_op == CON) {
-               cstmt->c_infinite = is_nonzero(tn);
+               cstmt->c_infinite = constant_is_nonzero(tn);
                if (!cstmt->c_infinite && cstmt->c_cont)
                        /* continue in 'do ... while (0)' loop */
                        error(323);
@@ -858,7 +858,7 @@
                expr(tn2, false, true, true, false);
 
        cstmt->c_infinite =
-           tn2 == NULL || (tn2->tn_op == CON && is_nonzero(tn2));
+           tn2 == NULL || (tn2->tn_op == CON && constant_is_nonzero(tn2));
 
        /* Checking the reinitialization expression is done in for2() */
 
diff -r 1d0bd4158fc5 -r 635d2c08d4ac usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Sun Feb 28 19:01:11 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Sun Feb 28 19:16:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.67 2021/02/28 03:59:28 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.68 2021/02/28 19:16:05 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -470,7 +470,7 @@
 }
 
 static inline bool
-is_nonzero(const tnode_t *tn)
+constant_is_nonzero(const tnode_t *tn)
 {
        /*
         * XXX: It's strange that val_t doesn't know itself whether it
diff -r 1d0bd4158fc5 -r 635d2c08d4ac usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sun Feb 28 19:01:11 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sun Feb 28 19:16:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.228 2021/02/28 18:51:51 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 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.228 2021/02/28 18:51:51 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.229 2021/02/28 19:16:05 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3188,8 +3188,8 @@
        v->v_tspec = tn->tn_type->t_tspec;
        lint_assert(v->v_tspec == INT || (Tflag && v->v_tspec == BOOL));
 
-       l = is_nonzero(tn->tn_left);
-       r = modtab[tn->tn_op].m_binary && is_nonzero(tn->tn_right);
+       l = constant_is_nonzero(tn->tn_left);
+       r = modtab[tn->tn_op].m_binary && constant_is_nonzero(tn->tn_right);
 
        switch (tn->tn_op) {
        case NOT:



Home | Main Index | Thread Index | Old Index