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: reduce verboseness of merge_signed...



details:   https://anonhg.NetBSD.org/src/rev/faf92dea928f
branches:  trunk
changeset: 1022407:faf92dea928f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 15 23:54:22 2021 +0000

description:
lint: reduce verboseness of merge_signedness

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c |  26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diffs (48 lines):

diff -r d9468c69a152 -r faf92dea928f usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Thu Jul 15 23:47:00 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Thu Jul 15 23:54:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.207 2021/07/15 23:54:22 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.206 2021/07/15 23:47:00 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.207 2021/07/15 23:54:22 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -386,20 +386,16 @@
 merge_signedness(tspec_t t, tspec_t s)
 {
 
-       if (s != SIGNED && s != UNSIGN)
+       if (s == SIGNED)
+               return t == CHAR ? SCHAR : t;
+       if (s != UNSIGN)
                return t;
-
-       if (t == CHAR)
-               return s == SIGNED ? SCHAR : UCHAR;
-       if (t == SHORT)
-               return s == SIGNED ? SHORT : USHORT;
-       if (t == INT)
-               return s == SIGNED ? INT : UINT;
-       if (t == LONG)
-               return s == SIGNED ? LONG : ULONG;
-       if (t == QUAD)
-               return s == SIGNED ? QUAD : UQUAD;
-       return t;
+       return t == CHAR ? UCHAR
+           : t == SHORT ? USHORT
+           : t == INT ? UINT
+           : t == LONG ? ULONG
+           : t == QUAD ? UQUAD
+           : t;
 }
 
 /*



Home | Main Index | Thread Index | Old Index