Module Name:    src
Committed By:   rillig
Date:           Sun Feb 28 19:16:05 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: func.c lint1.h tree.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.228 -r1.229 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/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.73 src/usr.bin/xlint/lint1/func.c:1.74
--- src/usr.bin/xlint/lint1/func.c:1.73	Mon Feb 22 15:09:50 2021
+++ src/usr.bin/xlint/lint1/func.c	Sun Feb 28 19:16:05 2021
@@ -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 @@ while1(tnode_t *tn)
 	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 @@ do2(tnode_t *tn)
 		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 @@ for1(tnode_t *tn1, tnode_t *tn2, tnode_t
 		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() */
 

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.67 src/usr.bin/xlint/lint1/lint1.h:1.68
--- src/usr.bin/xlint/lint1/lint1.h:1.67	Sun Feb 28 03:59:28 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Feb 28 19:16:05 2021
@@ -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 @@ is_nonzero_val(tspec_t t, const val_t *v
 }
 
 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

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.228 src/usr.bin/xlint/lint1/tree.c:1.229
--- src/usr.bin/xlint/lint1/tree.c:1.228	Sun Feb 28 18:51:51 2021
+++ src/usr.bin/xlint/lint1/tree.c	Sun Feb 28 19:16:05 2021
@@ -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 @@ fold_test(tnode_t *tn)
 	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:

Reply via email to