Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint2 lint: clean up switch statements in gettlen



details:   https://anonhg.NetBSD.org/src/rev/b3298a91d80b
branches:  trunk
changeset: 1023067:b3298a91d80b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 22 12:25:16 2021 +0000

description:
lint: clean up switch statements in gettlen

Since the switch statements are only about tagged and derived types,
there is no need to list all integer and floating types.

No functional change.

diffstat:

 usr.bin/xlint/lint2/read.c |  69 ++++-----------------------------------------
 1 files changed, 7 insertions(+), 62 deletions(-)

diffs (113 lines):

diff -r 8466d0549665 -r b3298a91d80b usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c        Sun Aug 22 12:15:37 2021 +0000
+++ b/usr.bin/xlint/lint2/read.c        Sun Aug 22 12:25:16 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.51 2021/08/22 12:15:37 rillig Exp $ */
+/* $NetBSD: read.c,v 1.52 2021/08/22 12:25:16 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: read.c,v 1.51 2021/08/22 12:15:37 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.52 2021/08/22 12:25:16 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -708,33 +708,7 @@
                        break;
                }
                break;
-       case LONG:
-       case VOID:
-       case LDOUBLE:
-       case DOUBLE:
-       case FLOAT:
-       case UQUAD:
-       case QUAD:
-#ifdef INT128_SIZE
-       case UINT128:
-       case INT128:
-#endif
-       case ULONG:
-       case UINT:
-       case INT:
-       case USHORT:
-       case SHORT:
-       case UCHAR:
-       case SCHAR:
-       case CHAR:
-       case BOOL:
-       case UNSIGN:
-       case SIGNED:
-       case NOTSPEC:
-       case FCOMPLEX:
-       case DCOMPLEX:
-       case LCOMPLEX:
-       case COMPLEX:
+       default:
                break;
        }
 
@@ -884,12 +858,11 @@
                }
                break;
        default:
-               inperr("bad type: %c %c", c, s);
+               break;
        }
 
-       if (t == NOTSPEC) {
-               inperr("undefined type: %c %c", c, s);
-       }
+       if (t == NOTSPEC)
+               inperr("bad type: %c %c", c, s);
 
        switch (t) {
        case ARRAY:
@@ -918,8 +891,6 @@
        case UNION:
                switch (*cp++) {
                case '1':
-                       (void)inpname(cp, &cp);
-                       break;
                case '2':
                        (void)inpname(cp, &cp);
                        break;
@@ -937,33 +908,7 @@
                        inperr("bad value: %c\n", cp[-1]);
                }
                break;
-       case FLOAT:
-       case USHORT:
-       case SHORT:
-       case UCHAR:
-       case SCHAR:
-       case CHAR:
-       case BOOL:
-       case UNSIGN:
-       case SIGNED:
-       case NOTSPEC:
-       case INT:
-       case UINT:
-       case DOUBLE:
-       case LDOUBLE:
-       case VOID:
-       case ULONG:
-       case LONG:
-       case QUAD:
-       case UQUAD:
-#ifdef INT128_SIZE
-       case INT128:
-       case UINT128:
-#endif
-       case FCOMPLEX:
-       case DCOMPLEX:
-       case LCOMPLEX:
-       case COMPLEX:
+       default:
                break;
        }
 



Home | Main Index | Thread Index | Old Index