Module Name:    src
Committed By:   rillig
Date:           Fri Jan  1 11:51:15 UTC 2021

Modified Files:
        src/usr.bin/xlint/common: lint.h
        src/usr.bin/xlint/lint1: decl.c scan.l
        src/usr.bin/xlint/lint2: read.c

Log Message:
lint: remove NTSPEC from enum tspec_t

The number of elements in an enumeration is not a valid enum constant of
that enumeration itself.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/xlint/lint1/scan.l
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint2/read.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/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.18 src/usr.bin/xlint/common/lint.h:1.19
--- src/usr.bin/xlint/common/lint.h:1.18	Wed Dec 30 10:46:11 2020
+++ src/usr.bin/xlint/common/lint.h	Fri Jan  1 11:51:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.h,v 1.18 2020/12/30 10:46:11 rillig Exp $	*/
+/*	$NetBSD: lint.h,v 1.19 2021/01/01 11:51:15 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -81,10 +81,11 @@ typedef enum {
 	COMPLEX,	/* _Complex */
 	FCOMPLEX,	/* float _Complex */
 	DCOMPLEX,	/* double _Complex */
-	LCOMPLEX,	/* long double _Complex */
-	NTSPEC
+	LCOMPLEX	/* long double _Complex */
+#define NTSPEC (LCOMPLEX + 1)
 } tspec_t;
 
+
 /*
  * size of types, name and classification
  */
@@ -118,15 +119,13 @@ extern	ttab_t	ttab[];
 
 
 typedef	enum {
-	NODECL,			/* until now not declared */
+	NODECL,			/* not declared until now */
 	DECL,			/* declared */
 	TDEF,			/* tentative defined */
 	DEF			/* defined */
 } def_t;
 
-/*
- * Following structure contains some data used for the output buffer.
- */
+/* Some data used for the output buffer. */
 typedef	struct	ob {
 	char	*o_buf;		/* buffer */
 	char	*o_end;		/* first byte after buffer */

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.94 src/usr.bin/xlint/lint1/decl.c:1.95
--- src/usr.bin/xlint/lint1/decl.c:1.94	Fri Jan  1 11:41:01 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Jan  1 11:51:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.94 2021/01/01 11:41:01 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.95 2021/01/01 11:51:15 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: decl.c,v 1.94 2021/01/01 11:41:01 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.95 2021/01/01 11:51:15 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -458,9 +458,6 @@ tdeferr(type_t *td, tspec_t t)
 	case LCOMPLEX:
 	case COMPLEX:
 		break;
-
-	case NTSPEC:	/* this value unused */
-		break;
 	}
 
 	/* Anything other is not accepted. */

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.108 src/usr.bin/xlint/lint1/scan.l:1.109
--- src/usr.bin/xlint/lint1/scan.l:1.108	Fri Jan  1 11:09:40 2021
+++ src/usr.bin/xlint/lint1/scan.l	Fri Jan  1 11:51:15 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.108 2021/01/01 11:09:40 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.109 2021/01/01 11:51:15 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.108 2021/01/01 11:09:40 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.109 2021/01/01 11:51:15 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -740,9 +740,6 @@ icon(int base)
 	case LCOMPLEX:
 	case COMPLEX:
 		break;
-
-	case NTSPEC:	/* this value unused */
-		break;
 	}
 
 	uq = (uint64_t)xsign((int64_t)uq, typ, -1);

Index: src/usr.bin/xlint/lint2/read.c
diff -u src/usr.bin/xlint/lint2/read.c:1.34 src/usr.bin/xlint/lint2/read.c:1.35
--- src/usr.bin/xlint/lint2/read.c:1.34	Wed Dec 30 11:39:55 2020
+++ src/usr.bin/xlint/lint2/read.c	Fri Jan  1 11:51:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.34 2020/12/30 11:39:55 rillig Exp $ */
+/* $NetBSD: read.c,v 1.35 2021/01/01 11:51:15 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.34 2020/12/30 11:39:55 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.35 2021/01/01 11:51:15 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -734,8 +734,6 @@ inptype(const char *cp, const char **epp
 	case LCOMPLEX:
 	case COMPLEX:
 		break;
-	case NTSPEC:
-		abort();
 	}
 
 	*epp = cp;
@@ -968,10 +966,6 @@ gettlen(const char *cp, const char **epp
 	case LCOMPLEX:
 	case COMPLEX:
 		break;
-#ifndef __COVERITY__
-	case NTSPEC:
-		abort();
-#endif
 	}
 
 	*epp = cp;

Reply via email to