lint: remove NTSPEC from enum tspec_t

The number of elements in an enumeration is not a valid enum constant of
that enumeration itself.
This commit is contained in:
rillig 2021-01-01 11:51:15 +00:00
parent 33a7d25ebe
commit d7a1ba0dec
4 changed files with 12 additions and 25 deletions

View File

@ -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 */

View File

@ -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. */

View File

@ -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);

View File

@ -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;