Module Name: src Committed By: rillig Date: Sat Mar 9 10:47:16 UTC 2024
Modified Files: src/usr.bin/xlint/lint1: cksnprintb.c lint1.h tree.c Log Message: lint: remove unneeded checks for left and right operands To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/xlint/lint1/cksnprintb.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.609 -r1.610 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/cksnprintb.c diff -u src/usr.bin/xlint/lint1/cksnprintb.c:1.7 src/usr.bin/xlint/lint1/cksnprintb.c:1.8 --- src/usr.bin/xlint/lint1/cksnprintb.c:1.7 Sun Mar 3 16:09:01 2024 +++ src/usr.bin/xlint/lint1/cksnprintb.c Sat Mar 9 10:47:16 2024 @@ -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); Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.216 src/usr.bin/xlint/lint1/lint1.h:1.217 --- src/usr.bin/xlint/lint1/lint1.h:1.216 Sat Mar 9 10:41:11 2024 +++ src/usr.bin/xlint/lint1/lint1.h Sat Mar 9 10:47:16 2024 @@ -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" Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.609 src/usr.bin/xlint/lint1/tree.c:1.610 --- src/usr.bin/xlint/lint1/tree.c:1.609 Sun Mar 3 16:09:01 2024 +++ src/usr.bin/xlint/lint1/tree.c Sat Mar 9 10:47:16 2024 @@ -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 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)