Module Name:    src
Committed By:   rillig
Date:           Sat Sep  4 14:07:51 UTC 2021

Modified Files:
        src/usr.bin/xlint/common: inittyp.c tyname.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/common/tyname.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.27 src/usr.bin/xlint/common/inittyp.c:1.28
--- src/usr.bin/xlint/common/inittyp.c:1.27	Sat Sep  4 10:26:44 2021
+++ src/usr.bin/xlint/common/inittyp.c	Sat Sep  4 14:07:51 2021
@@ -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 @@ inittyp(void)
 		    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 @@ inittyp(void)
 		    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
 	};
 

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.48 src/usr.bin/xlint/common/tyname.c:1.49
--- src/usr.bin/xlint/common/tyname.c:1.48	Sat Sep  4 13:53:20 2021
+++ src/usr.bin/xlint/common/tyname.c	Sat Sep  4 14:07:51 2021
@@ -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 @@ buf_add_int(buffer *buf, int n)
 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;

Reply via email to