Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint lint: inline local variables in outtype



details:   https://anonhg.NetBSD.org/src/rev/546b2b4bff86
branches:  trunk
changeset: 1023369:546b2b4bff86
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 04 18:58:57 2021 +0000

description:
lint: inline local variables in outtype

No functional change.

diffstat:

 usr.bin/xlint/lint1/emit1.c |  16 +++++++---------
 usr.bin/xlint/lint2/emit2.c |  28 +++++++++++++---------------
 2 files changed, 20 insertions(+), 24 deletions(-)

diffs (113 lines):

diff -r 1018114df16c -r 546b2b4bff86 usr.bin/xlint/lint1/emit1.c
--- a/usr.bin/xlint/lint1/emit1.c       Sat Sep 04 18:49:33 2021 +0000
+++ b/usr.bin/xlint/lint1/emit1.c       Sat Sep 04 18:58:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.57 2021/09/04 14:58:42 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.58 2021/09/04 18:58:57 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: emit1.c,v 1.57 2021/09/04 14:58:42 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.58 2021/09/04 18:58:57 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -100,7 +100,6 @@
        static const char tt[NTSPEC] = "???BCCCSSIILLQQDDDVTTTPAF?XXX";
        static const char ss[NTSPEC] = "???  su u u u us l sue   ?s l";
 #endif
-       char    t, s;
        int     na;
        sym_t   *arg;
        tspec_t ts;
@@ -108,16 +107,15 @@
        while (tp != NULL) {
                if ((ts = tp->t_tspec) == INT && tp->t_is_enum)
                        ts = ENUM;
-               t = tt[ts];
-               s = ss[ts];
-               lint_assert(t != '?' && s != '?');
+               lint_assert(tt[ts] != '?' && ss[ts] != '?');
                if (tp->t_const)
                        outchar('c');
                if (tp->t_volatile)
                        outchar('v');
-               if (s != ' ')
-                       outchar(s);
-               outchar(t);
+               if (ss[ts] != ' ')
+                       outchar(ss[ts]);
+               outchar(tt[ts]);
+
                if (ts == ARRAY) {
                        outint(tp->t_dim);
                } else if (ts == ENUM) {
diff -r 1018114df16c -r 546b2b4bff86 usr.bin/xlint/lint2/emit2.c
--- a/usr.bin/xlint/lint2/emit2.c       Sat Sep 04 18:49:33 2021 +0000
+++ b/usr.bin/xlint/lint2/emit2.c       Sat Sep 04 18:58:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.25 2021/09/04 18:49:33 rillig Exp $ */
+/* $NetBSD: emit2.c,v 1.26 2021/09/04 18:58:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: emit2.c,v 1.25 2021/09/04 18:49:33 rillig Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.26 2021/09/04 18:58:57 rillig Exp $");
 #endif
 
 #include "lint2.h"
@@ -50,11 +50,6 @@
 static void
 outtype(type_t *tp)
 {
-       char    t, s;
-       int     na;
-       tspec_t ts;
-       type_t  **ap;
-
 #ifdef INT128_SIZE
        static const char tt[NTSPEC] = "???BCCCSSIILLQQJJDDDVTTTPAF?XXX";
        static const char ss[NTSPEC] = "???  su u u u u us l sue   ?s l";
@@ -62,23 +57,26 @@
        static const char tt[NTSPEC] = "???BCCCSSIILLQQDDDVTTTPAF?XXX";
        static const char ss[NTSPEC] = "???  su u u u us l sue   ?s l";
 #endif
+       int     na;
+       tspec_t ts;
+       type_t  **ap;
 
        while (tp != NULL) {
                if ((ts = tp->t_tspec) == INT && tp->t_is_enum)
                        ts = ENUM;
-               t = tt[ts];
-               s = ss[ts];
-               if (!ch_isupper(t))
+               if (!ch_isupper(tt[ts]))
                        errx(1, "internal error: outtype(%d)", ts);
-               if (ts == FUNC && tp->t_args != NULL && !tp->t_proto)
-                       t = 'f';
                if (tp->t_const)
                        outchar('c');
                if (tp->t_volatile)
                        outchar('v');
-               if (s != ' ')
-                       outchar(s);
-               outchar(t);
+               if (ss[ts] != ' ')
+                       outchar(ss[ts]);
+               if (ts == FUNC && tp->t_args != NULL && !tp->t_proto)
+                       outchar('f');
+               else
+                       outchar(tt[ts]);
+
                if (ts == ARRAY) {
                        outint(tp->t_dim);
                } else if (ts == ENUM || ts == STRUCT || ts == UNION) {



Home | Main Index | Thread Index | Old Index