Module Name: src Committed By: rillig Date: Sat Sep 4 09:26:22 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: clean up switch statement in typeok_op In the old times where typeok_op was inlined into typeok, it was necessary to write the complicated if-not-return-break. Not anymore. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.373 -r1.374 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/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.373 src/usr.bin/xlint/lint1/tree.c:1.374 --- src/usr.bin/xlint/lint1/tree.c:1.373 Sat Sep 4 09:18:25 2021 +++ src/usr.bin/xlint/lint1/tree.c Sat Sep 4 09:26:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.373 2021/09/04 09:18:25 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.374 2021/09/04 09:26:21 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.373 2021/09/04 09:18:25 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.374 2021/09/04 09:26:21 rillig Exp $"); #endif #include <float.h> @@ -1189,25 +1189,15 @@ typeok_op(op_t op, const mod_t *mp, int case DECAFT: case INCBEF: case DECBEF: - if (!typeok_incdec(op, ln, ltp)) - return false; - break; + return typeok_incdec(op, ln, ltp); case ADDR: - if (!typeok_address(mp, ln, ltp, lt)) - return false; - break; + return typeok_address(mp, ln, ltp, lt); case INDIR: - if (!typeok_star(lt)) - return false; - break; + return typeok_star(lt); case PLUS: - if (!typeok_plus(op, ltp, lt, rtp, rt)) - return false; - break; + return typeok_plus(op, ltp, lt, rtp, rt); case MINUS: - if (!typeok_minus(op, ltp, lt, rtp, rt)) - return false; - break; + return typeok_minus(op, ltp, lt, rtp, rt); case SHR: typeok_shr(mp, ln, lt, rn, rt); goto shift; @@ -1229,17 +1219,11 @@ typeok_op(op_t op, const mod_t *mp, int case GT: case LE: case GE: - if (!typeok_ordered_comparison(op, ln, ltp, lt, rn, rtp, rt)) - return false; - break; + return typeok_ordered_comparison(op, ln, ltp, lt, rn, rtp, rt); case QUEST: - if (!typeok_quest(lt, rn)) - return false; - break; + return typeok_quest(lt, rn); case COLON: - if (!typeok_colon(mp, ln, ltp, lt, rn, rtp, rt)) - return false; - break; + return typeok_colon(mp, ln, ltp, lt, rn, rtp, rt); case ASSIGN: case INIT: case FARG: @@ -1272,9 +1256,7 @@ typeok_op(op_t op, const mod_t *mp, int case ORASS: goto assign; assign: - if (!typeok_assign(op, ln, ltp, lt)) - return false; - break; + return typeok_assign(op, ln, ltp, lt); case COMMA: if (!modtab[ln->tn_op].m_has_side_effect) check_null_effect(ln);