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



details:   https://anonhg.NetBSD.org/src/rev/a4d88623cdd9
branches:  trunk
changeset: 379706:a4d88623cdd9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jun 15 17:17:14 2021 +0000

description:
lint: merge duplicate code

diffstat:

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

diffs (36 lines):

diff -r 196abd288019 -r a4d88623cdd9 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Jun 15 17:16:16 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Jun 15 17:17:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.283 2021/06/15 17:13:08 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.284 2021/06/15 17:17:14 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.283 2021/06/15 17:13:08 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.284 2021/06/15 17:17:14 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2336,13 +2336,10 @@ convert_constant(op_t op, int arg, const
                }
        }
 
-       if (v->v_ansiu && is_floating(nt)) {
-               /* ANSI C treats constant as unsigned */
-               warning(157);
-               v->v_ansiu = false;
-       } else if (v->v_ansiu && (is_integer(nt) && !is_uinteger(nt) &&
-                                 portable_size_in_bits(nt) >
-                                 portable_size_in_bits(ot))) {
+       if ((v->v_ansiu && is_floating(nt)) ||
+           (v->v_ansiu && (is_integer(nt) && !is_uinteger(nt) &&
+                           portable_size_in_bits(nt) >
+                           portable_size_in_bits(ot)))) {
                /* ANSI C treats constant as unsigned */
                warning(157);
                v->v_ansiu = false;



Home | Main Index | Thread Index | Old Index