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 _Complex from tspec_name



details:   https://anonhg.NetBSD.org/src/rev/e2cb4e32d023
branches:  trunk
changeset: 1023357:e2cb4e32d023
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 04 14:07:51 2021 +0000

description:
lint: remove _Complex from tspec_name

That type is only used in the parser; the expression trees use FCOMPLEX,
DCOMPLEX or LCOMPLEX instead.

Sort the typeinfo definitions according to their order in tspec_t.  Do
not add _Complex there since it is not needed.  This means that NOTSPEC
and COMPLEX would both trigger an internal error.

diffstat:

 usr.bin/xlint/common/inittyp.c |  18 +++++++++---------
 usr.bin/xlint/common/tyname.c  |   6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)

diffs (73 lines):

diff -r bd9e4f128886 -r e2cb4e32d023 usr.bin/xlint/common/inittyp.c
--- a/usr.bin/xlint/common/inittyp.c    Sat Sep 04 13:53:20 2021 +0000
+++ b/usr.bin/xlint/common/inittyp.c    Sat Sep 04 14:07:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $      */
+/*     $NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: inittyp.c,v 1.27 2021/09/04 10:26:44 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.28 2021/09/04 14:07:51 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -112,13 +112,6 @@
                    0, 0, 1, 1, 1, 0, "double"),
                typeinfo(LDOUBLE, LDOUBLE, LDOUBLE, LDOUBLE_SIZE, 80,
                    0, 0, 1, 1, 1, 0, "long double"),
-               typeinfo(FCOMPLEX, FCOMPLEX, FCOMPLEX, FLOAT_SIZE * 2, 32 * 2,
-                   0, 0, 1, 1, 1, 1, "float _Complex"),
-               typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
-                   0, 0, 1, 1, 1, 1, "double _Complex"),
-               typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
-                   LDOUBLE_SIZE * 2, 80 * 2,
-                   0, 0, 1, 1, 1, 1, "long double _Complex"),
                typeinfo(VOID, VOID, VOID, 0, 0,
                    0, 0, 0, 0, 0, 0, "void"),
                typeinfo(STRUCT, STRUCT, STRUCT, 0, 0,
@@ -133,6 +126,13 @@
                    0, 0, 0, 0, 0, 0, "array"),
                typeinfo(FUNC, FUNC, FUNC, 0, 0,
                    0, 0, 0, 0, 0, 0, "function"),
+               typeinfo(FCOMPLEX, FCOMPLEX, FCOMPLEX, FLOAT_SIZE * 2, 32 * 2,
+                   0, 0, 1, 1, 1, 1, "float _Complex"),
+               typeinfo(DCOMPLEX, DCOMPLEX, DCOMPLEX, DOUBLE_SIZE * 2, 64 * 2,
+                   0, 0, 1, 1, 1, 1, "double _Complex"),
+               typeinfo(LCOMPLEX, LCOMPLEX, LCOMPLEX,
+                   LDOUBLE_SIZE * 2, 80 * 2,
+                   0, 0, 1, 1, 1, 1, "long double _Complex"),
 #undef typeinfo
        };
 
diff -r bd9e4f128886 -r e2cb4e32d023 usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Sat Sep 04 13:53:20 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c     Sat Sep 04 14:07:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.48 2021/09/04 13:53:20 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.49 2021/09/04 14:07:51 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.48 2021/09/04 13:53:20 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.49 2021/09/04 14:07:51 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -150,7 +150,7 @@
 const char *
 tspec_name(tspec_t t)
 {
-       const char *name = t == COMPLEX ? "_Complex" : ttab[t].tt_name;
+       const char *name = ttab[t].tt_name;
        if (name == NULL)
                INTERNAL_ERROR("tspec_name(%d)", t);
        return name;



Home | Main Index | Thread Index | Old Index