lint: remove unneeded checks for left and right operands
This commit is contained in:
parent
5a97e61464
commit
70f9d5c54d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cksnprintb.c,v 1.7 2024/03/03 16:09:01 rillig Exp $ */
|
||||
/* $NetBSD: cksnprintb.c,v 1.8 2024/03/09 10:47:16 rillig Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2024 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID)
|
||||
__RCSID("$NetBSD: cksnprintb.c,v 1.7 2024/03/03 16:09:01 rillig Exp $");
|
||||
__RCSID("$NetBSD: cksnprintb.c,v 1.8 2024/03/09 10:47:16 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
@ -59,7 +59,7 @@ static bool
|
|||
match_string_literal(const tnode_t *tn, const buffer **str)
|
||||
{
|
||||
while (tn->tn_op == CVT)
|
||||
tn = tn_ck_left(tn);
|
||||
tn = tn->tn_left;
|
||||
return tn->tn_op == ADDR
|
||||
&& tn->tn_left->tn_op == STRING
|
||||
&& (*str = tn->tn_left->tn_string, (*str)->data != NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lint1.h,v 1.216 2024/03/09 10:41:11 rillig Exp $ */
|
||||
/* $NetBSD: lint1.h,v 1.217 2024/03/09 10:47:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
|
@ -555,20 +555,6 @@ typedef struct {
|
|||
assert_failed(__FILE__, __LINE__, __func__, #cond); \
|
||||
} while (false)
|
||||
|
||||
static inline tnode_t *
|
||||
tn_ck_left(const tnode_t *tn)
|
||||
{
|
||||
lint_assert(has_operands(tn));
|
||||
return tn->tn_left;
|
||||
}
|
||||
|
||||
static inline tnode_t *
|
||||
tn_ck_right(const tnode_t *tn)
|
||||
{
|
||||
lint_assert(has_operands(tn));
|
||||
return tn->tn_right;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
# include "err-msgs.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tree.c,v 1.609 2024/03/03 16:09:01 rillig Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.610 2024/03/09 10:47:16 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.609 2024/03/03 16:09:01 rillig Exp $");
|
||||
__RCSID("$NetBSD: tree.c,v 1.610 2024/03/09 10:47:16 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
@ -1236,7 +1236,7 @@ build_colon(bool sys, tnode_t *ln, tnode_t *rn)
|
|||
static bool
|
||||
is_cast_redundant(const tnode_t *tn)
|
||||
{
|
||||
const type_t *ntp = tn->tn_type, *otp = tn_ck_left(tn)->tn_type;
|
||||
const type_t *ntp = tn->tn_type, *otp = tn->tn_left->tn_type;
|
||||
tspec_t nt = ntp->t_tspec, ot = otp->t_tspec;
|
||||
|
||||
if (nt == BOOL || ot == BOOL)
|
||||
|
|
Loading…
Reference in New Issue