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: merge duplicate code in typeok_minus



details:   https://anonhg.NetBSD.org/src/rev/25364bb7a978
branches:  trunk
changeset: 367684:25364bb7a978
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jun 21 22:21:49 2022 +0000

description:
lint: merge duplicate code in typeok_minus

No functional change.

diffstat:

 usr.bin/xlint/lint1/tree.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r fef97e09ecaf -r 25364bb7a978 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Jun 21 22:16:26 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Jun 21 22:21:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.457 2022/06/21 22:16:26 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.458 2022/06/21 22:21:49 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.457 2022/06/21 22:16:26 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.458 2022/06/21 22:21:49 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1106,10 +1106,8 @@
             const type_t *rtp, tspec_t rt)
 {
        /* operands have scalar types (checked in typeok) */
-       if (lt == PTR && (!is_integer(rt) && rt != PTR)) {
-               warn_incompatible_types(op, ltp, lt, rtp, rt);
-               return false;
-       } else if (rt == PTR && lt != PTR) {
+       if ((lt == PTR && rt != PTR && !is_integer(rt)) ||
+           (lt != PTR && rt == PTR)) {
                warn_incompatible_types(op, ltp, lt, rtp, rt);
                return false;
        }



Home | Main Index | Thread Index | Old Index