Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/common lint: remove unnecessary switch statement



details:   https://anonhg.NetBSD.org/src/rev/3e87d9b1037e
branches:  trunk
changeset: 1023283:3e87d9b1037e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Aug 31 23:49:21 2021 +0000

description:
lint: remove unnecessary switch statement

The switch statement covers only the few structural types, there is no
need to list all integer types as well.

No functional change.

diffstat:

 usr.bin/xlint/common/tyname.c |  33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)

diffs (61 lines):

diff -r 6f7aedcbd6db -r 3e87d9b1037e usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Tue Aug 31 23:10:52 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c     Tue Aug 31 23:49:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.45 2021/08/28 13:29:26 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.46 2021/08/31 23:49:21 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -303,33 +303,6 @@
        buf_add(&buf, tspec_name(t));
 
        switch (t) {
-       case BOOL:
-       case CHAR:
-       case UCHAR:
-       case SCHAR:
-       case SHORT:
-       case USHORT:
-       case INT:
-       case UINT:
-       case LONG:
-       case ULONG:
-       case QUAD:
-       case UQUAD:
-#ifdef INT128_SIZE
-       case INT128:
-       case UINT128:
-#endif
-       case FLOAT:
-       case DOUBLE:
-       case LDOUBLE:
-       case VOID:
-       case COMPLEX:
-       case FCOMPLEX:
-       case DCOMPLEX:
-       case LCOMPLEX:
-       case SIGNED:
-       case UNSIGN:
-               break;
        case PTR:
                buf_add(&buf, " to ");
                buf_add(&buf, type_name(tp->t_subt));
@@ -348,7 +321,7 @@
                type_name_of_function(&buf, tp);
                break;
        default:
-               INTERNAL_ERROR("type_name(%d)", t);
+               break;
        }
 
        name = intern(buf.data);



Home | Main Index | Thread Index | Old Index