Module Name:    src
Committed By:   rillig
Date:           Tue Jun 15 17:17:15 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: merge duplicate code


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 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.283 src/usr.bin/xlint/lint1/tree.c:1.284
--- src/usr.bin/xlint/lint1/tree.c:1.283	Tue Jun 15 17:13:08 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 15 17:17:14 2021
@@ -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;

Reply via email to