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: remove NTSPEC from enum tspec_t



details:   https://anonhg.NetBSD.org/src/rev/3e5f2673cb87
branches:  trunk
changeset: 1017595:3e5f2673cb87
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 01 11:51:15 2021 +0000

description:
lint: remove NTSPEC from enum tspec_t

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

diffstat:

 usr.bin/xlint/common/lint.h |  13 ++++++-------
 usr.bin/xlint/lint1/decl.c  |   7 ++-----
 usr.bin/xlint/lint1/scan.l  |   7 ++-----
 usr.bin/xlint/lint2/read.c  |  10 ++--------
 4 files changed, 12 insertions(+), 25 deletions(-)

diffs (136 lines):

diff -r 90fdda19b9cb -r 3e5f2673cb87 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Fri Jan 01 11:44:41 2021 +0000
+++ b/usr.bin/xlint/common/lint.h       Fri Jan 01 11:51:15 2021 +0000
@@ -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 @@
        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 @@
 
 
 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 */
diff -r 90fdda19b9cb -r 3e5f2673cb87 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Jan 01 11:44:41 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Jan 01 11:51:15 2021 +0000
@@ -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 @@
        case LCOMPLEX:
        case COMPLEX:
                break;
-
-       case NTSPEC:    /* this value unused */
-               break;
        }
 
        /* Anything other is not accepted. */
diff -r 90fdda19b9cb -r 3e5f2673cb87 usr.bin/xlint/lint1/scan.l
--- a/usr.bin/xlint/lint1/scan.l        Fri Jan 01 11:44:41 2021 +0000
+++ b/usr.bin/xlint/lint1/scan.l        Fri Jan 01 11:51:15 2021 +0000
@@ -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 @@
        case LCOMPLEX:
        case COMPLEX:
                break;
-
-       case NTSPEC:    /* this value unused */
-               break;
        }
 
        uq = (uint64_t)xsign((int64_t)uq, typ, -1);
diff -r 90fdda19b9cb -r 3e5f2673cb87 usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c        Fri Jan 01 11:44:41 2021 +0000
+++ b/usr.bin/xlint/lint2/read.c        Fri Jan 01 11:51:15 2021 +0000
@@ -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 @@
        case LCOMPLEX:
        case COMPLEX:
                break;
-       case NTSPEC:
-               abort();
        }
 
        *epp = cp;
@@ -968,10 +966,6 @@
        case LCOMPLEX:
        case COMPLEX:
                break;
-#ifndef __COVERITY__
-       case NTSPEC:
-               abort();
-#endif
        }
 
        *epp = cp;



Home | Main Index | Thread Index | Old Index