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: replace integer constants with boo...
details: https://anonhg.NetBSD.org/src/rev/7099e6c642a0
branches: trunk
changeset: 979937:7099e6c642a0
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 17 15:24:03 2021 +0000
description:
lint: replace integer constants with bool constants
diffstat:
usr.bin/xlint/lint1/decl.c | 6 ++--
usr.bin/xlint/lint1/tree.c | 54 +++++++++++++++++++++++-----------------------
2 files changed, 30 insertions(+), 30 deletions(-)
diffs (235 lines):
diff -r 316c69becfd0 -r 7099e6c642a0 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c Sun Jan 17 15:13:15 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c Sun Jan 17 15:24:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.125 2021/01/17 11:28:01 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.126 2021/01/17 15:24:03 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.125 2021/01/17 11:28:01 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.126 2021/01/17 15:24:03 rillig Exp $");
#endif
#include <sys/param.h>
@@ -1389,7 +1389,7 @@
*tpp = tp = getblk(sizeof (type_t));
tp->t_tspec = FUNC;
tp->t_subt = dcs->d_next->d_type;
- if ((tp->t_proto = dcs->d_proto) != 0)
+ if ((tp->t_proto = dcs->d_proto) != false)
tp->t_args = args;
tp->t_vararg = dcs->d_vararg;
diff -r 316c69becfd0 -r 7099e6c642a0 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:13:15 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sun Jan 17 15:24:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.171 2021/01/17 15:06:54 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 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.171 2021/01/17 15:06:54 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.172 2021/01/17 15:24:03 rillig Exp $");
#endif
#include <float.h>
@@ -534,14 +534,14 @@
* Promote the left operand if it is in a test or value context
*/
if (mp->m_left_value_context || mp->m_left_test_context)
- ln = promote(op, 0, ln);
+ ln = promote(op, false, ln);
/*
* Promote the right operand, but only if it is no struct or
* union member, or if it is not to be assigned to the left operand
*/
if (mp->m_binary && op != ARROW && op != POINT &&
op != ASSIGN && op != RETURN) {
- rn = promote(op, 0, rn);
+ rn = promote(op, false, rn);
}
/*
@@ -586,7 +586,7 @@
ntn = build_prepost_incdec(op, ln);
break;
case ADDR:
- ntn = build_address(ln, 0);
+ ntn = build_address(ln, false);
break;
case INDIR:
ntn = new_tnode(INDIR, ln->tn_type->t_subt, ln, NULL);
@@ -704,7 +704,7 @@
* of type T)
*/
if (tn->tn_type->t_tspec == FUNC)
- tn = build_address(tn, 1);
+ tn = build_address(tn, true);
/* lvalue to rvalue */
if (tn->tn_lvalue) {
@@ -848,7 +848,7 @@
return false;
}
if (lt == PTR && rt == PTR) {
- if (!eqtype(ltp->t_subt, rtp->t_subt, 1, 0, NULL)) {
+ if (!eqtype(ltp->t_subt, rtp->t_subt, true, false, NULL)) {
/* illegal pointer subtraction */
error(116);
}
@@ -1056,9 +1056,9 @@
}
if (rt == PTR && lt == PTR) {
- if (eqptrtype(lstp, rstp, 1))
+ if (eqptrtype(lstp, rstp, true))
return true;
- if (!eqtype(lstp, rstp, 1, 0, NULL))
+ if (!eqtype(lstp, rstp, true, false, NULL))
warn_incompatible_pointers(mp, ltp, rtp);
return true;
}
@@ -1475,7 +1475,7 @@
return;
}
- if (!eqtype(ltp->t_subt, rtp->t_subt, 1, 0, NULL)) {
+ if (!eqtype(ltp->t_subt, rtp->t_subt, true, false, NULL)) {
warn_incompatible_pointers(&modtab[op], ltp, rtp);
return;
}
@@ -1548,7 +1548,7 @@
}
if (lt == PTR && rt == PTR && (lst == VOID || rst == VOID ||
- eqtype(lstp, rstp, 1, 0, NULL))) {
+ eqtype(lstp, rstp, true, false, NULL))) {
/* compatible pointer types (qualifiers ignored) */
if (!tflag &&
((!lstp->t_const && rstp->t_const) ||
@@ -2052,7 +2052,7 @@
return;
/* get default promotion */
- ptn = promote(NOOP, 1, tn);
+ ptn = promote(NOOP, true, tn);
ot = ptn->tn_type->t_tspec;
/* return if types are the same with and without prototype */
@@ -2614,7 +2614,7 @@
nolval = op == POINT && !ln->tn_lvalue;
if (op == POINT) {
- ln = build_address(ln, 1);
+ ln = build_address(ln, true);
} else if (ln->tn_type->t_tspec != PTR) {
lint_assert(tflag);
lint_assert(is_integer(ln->tn_type->t_tspec));
@@ -3260,8 +3260,8 @@
lint_assert(/*CONSTCOND*/false);
}
- lint_assert(fpe != 0 || isnan((double)v->v_ldbl) == false);
- if (fpe != 0 || finite((double)v->v_ldbl) == false ||
+ lint_assert(fpe != 0 || isnan((double)v->v_ldbl) == 0);
+ if (fpe != 0 || finite((double)v->v_ldbl) == 0 ||
(t == FLOAT &&
(v->v_ldbl > FLT_MAX || v->v_ldbl < -FLT_MAX)) ||
(t == DOUBLE &&
@@ -3634,7 +3634,7 @@
arg->tn_left = check_prototype_argument(
n, asym->s_type, arg->tn_left);
} else {
- arg->tn_left = promote(NOOP, 1, arg->tn_left);
+ arg->tn_left = promote(NOOP, true, arg->tn_left);
}
arg->tn_type = arg->tn_left->tn_type;
@@ -3686,7 +3686,7 @@
if (tn != NULL)
tn = cconv(tn);
if (tn != NULL)
- tn = promote(NOOP, 0, tn);
+ tn = promote(NOOP, false, tn);
v = xcalloc(1, sizeof (val_t));
@@ -3749,7 +3749,7 @@
if (dcs->d_ctx != EXTERN)
check_statement_reachable();
- check_expr_misc(tn, vctx, tctx, !tctx, 0, 0, 0);
+ check_expr_misc(tn, vctx, tctx, !tctx, false, false, false);
if (tn->tn_op == ASSIGN) {
if (hflag && tctx)
/* assignment in conditional context */
@@ -3906,12 +3906,12 @@
}
if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
/* check the range of array indices */
- check_array_index(ln->tn_left, 1);
+ check_array_index(ln->tn_left, true);
break;
case LOAD:
if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
/* check the range of array indices */
- check_array_index(ln->tn_left, 0);
+ check_array_index(ln->tn_left, false);
/* FALLTHROUGH */
case PUSH:
case INCBEF:
@@ -3947,7 +3947,7 @@
warning(158, ln->tn_sym->s_name);
mark_as_set(ln->tn_sym);
}
- mark_as_used(ln->tn_sym, 0, 0);
+ mark_as_used(ln->tn_sym, false, false);
}
break;
case ASSIGN:
@@ -3958,7 +3958,7 @@
}
if (ln->tn_op == INDIR && ln->tn_left->tn_op == PLUS)
/* check the range of array indices */
- check_array_index(ln->tn_left, 0);
+ check_array_index(ln->tn_left, false);
break;
case CALL:
lint_assert(ln->tn_op == ADDR);
@@ -4032,21 +4032,21 @@
switch (op) {
case PUSH:
if (rn != NULL)
- check_expr_misc(rn, 0, 0, mp->m_warn_if_operand_eq, 0, 0, szof);
+ check_expr_misc(rn, false, false, mp->m_warn_if_operand_eq, false, false, szof);
break;
case LOGAND:
case LOGOR:
- check_expr_misc(rn, 0, 1, mp->m_warn_if_operand_eq, 0, 0, szof);
+ check_expr_misc(rn, false, true, mp->m_warn_if_operand_eq, false, false, szof);
break;
case COLON:
- check_expr_misc(rn, cvctx, ctctx, mp->m_warn_if_operand_eq, 0, 0, szof);
+ check_expr_misc(rn, cvctx, ctctx, mp->m_warn_if_operand_eq, false, false, szof);
break;
case COMMA:
- check_expr_misc(rn, vctx, tctx, mp->m_warn_if_operand_eq, 0, 0, szof);
+ check_expr_misc(rn, vctx, tctx, mp->m_warn_if_operand_eq, false, false, szof);
break;
default:
if (mp->m_binary)
- check_expr_misc(rn, 1, 0, mp->m_warn_if_operand_eq, 0, 0, szof);
+ check_expr_misc(rn, true, false, mp->m_warn_if_operand_eq, false, false, szof);
break;
}
Home |
Main Index |
Thread Index |
Old Index