Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint2 lint: rename constant NOTSPEC to NO_TSPEC



details:   https://anonhg.NetBSD.org/src/rev/21e47e0ebf99
branches:  trunk
changeset: 375922:21e47e0ebf99
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon May 22 12:55:04 2023 +0000

description:
lint: rename constant NOTSPEC to NO_TSPEC

It was too easy to misread the old name as NOT_SPEC instead of the
intended NO_TSPEC.

diffstat:

 tests/usr.bin/xlint/lint1/decl_struct_member.c |   4 +-
 tests/usr.bin/xlint/lint1/msg_108.c            |   6 +-
 tests/usr.bin/xlint/lint2/read.ln              |   4 +-
 usr.bin/xlint/common/inittyp.c                 |  10 +-
 usr.bin/xlint/common/lint.h                    |   4 +-
 usr.bin/xlint/lint1/ckbool.c                   |   6 +-
 usr.bin/xlint/lint1/debug.c                    |  12 +-
 usr.bin/xlint/lint1/decl.c                     |  88 +++++++++++++-------------
 usr.bin/xlint/lint1/tree.c                     |  10 +-
 usr.bin/xlint/lint2/chk.c                      |  50 +++++++-------
 usr.bin/xlint/lint2/read.c                     |   8 +-
 11 files changed, 101 insertions(+), 101 deletions(-)

diffs (truncated from 706 to 300 lines):

diff -r a0e81e0f5a16 -r 21e47e0ebf99 tests/usr.bin/xlint/lint1/decl_struct_member.c
--- a/tests/usr.bin/xlint/lint1/decl_struct_member.c    Mon May 22 12:34:48 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_struct_member.c    Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: decl_struct_member.c,v 1.16 2023/03/28 14:44:34 rillig Exp $   */
+/*     $NetBSD: decl_struct_member.c,v 1.17 2023/05/22 12:55:04 rillig Exp $   */
 # 3 "decl_struct_member.c"
 
 /* lint1-extra-flags: -X 351 */
@@ -86,7 +86,7 @@ struct {
  * Before cgram.y 1.328 from 2021-07-15, lint ran into an assertion failure
  * at the closing semicolon:
  *
- * assertion "t == NOTSPEC" failed in end_type at decl.c:774
+ * assertion "t == NO_TSPEC" failed in end_type at decl.c:774
  */
 };
 /* expect+1: error: cannot recover from previous errors [224] */
diff -r a0e81e0f5a16 -r 21e47e0ebf99 tests/usr.bin/xlint/lint1/msg_108.c
--- a/tests/usr.bin/xlint/lint1/msg_108.c       Mon May 22 12:34:48 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_108.c       Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_108.c,v 1.7 2022/06/21 21:18:30 rillig Exp $       */
+/*     $NetBSD: msg_108.c,v 1.8 2023/05/22 12:55:04 rillig Exp $       */
 # 3 "msg_108.c"
 
 // Test for message: operand of '%s' has invalid type '%s' [108]
@@ -6,8 +6,8 @@
 /*
  * Before tree.c 1.137 from 2021-01-19, taking the complement of a struct
  * (an absurd idea, by the way), resulted in an internal error because the
- * message 108 had two operands, the second of which was always NOTSPEC, as
- * could be expected for a unary operator.
+ * message 108 took two type operands, the second of which was not available
+ * for unary operators.
  *
  * Since an error "invalid type 'none'" doesn't make sense, lint rather chose
  * to crash than to generate such an error.
diff -r a0e81e0f5a16 -r 21e47e0ebf99 tests/usr.bin/xlint/lint2/read.ln
--- a/tests/usr.bin/xlint/lint2/read.ln Mon May 22 12:34:48 2023 +0000
+++ b/tests/usr.bin/xlint/lint2/read.ln Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: read.ln,v 1.5 2021/08/30 21:23:37 rillig Exp $
+# $NetBSD: read.ln,v 1.6 2023/05/22 12:55:04 rillig Exp $
 #
 # Cover each path of reading declarations, definitions and usages.
 
@@ -10,7 +10,7 @@ S read.c
 # The line numbers correspond to the constant values of tspec_t,
 # with the 128-bit types included.
 #
-# NOTSPEC      cannot occur in lint1 output.
+# NO_TSPEC     cannot occur in lint1 output.
 # SIGNED       cannot occur in lint1 output.
 # UNSIGN       cannot occur in lint1 output.
 103 d 0.103 e 4f103 F0 B       # BOOL          _Bool           f103(void);
diff -r a0e81e0f5a16 -r 21e47e0ebf99 usr.bin/xlint/common/inittyp.c
--- a/usr.bin/xlint/common/inittyp.c    Mon May 22 12:34:48 2023 +0000
+++ b/usr.bin/xlint/common/inittyp.c    Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $      */
+/*     $NetBSD: inittyp.c,v 1.34 2023/05/22 12:55:04 rillig Exp $      */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $");
+__RCSID("$NetBSD: inittyp.c,v 1.34 2023/05/22 12:55:04 rillig Exp $");
 #endif
 
 #if defined(IS_LINT1)
@@ -80,7 +80,7 @@
 
 /* various type information */
 ttab_t ttab[NTSPEC] = {
-       typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, ' '),
+       typeinfo(NULL, NO_TSPEC, NO_TSPEC, 0, 0, ' '),
        typeinfo("signed", SIGNED, UNSIGN, 0, 0, ' '),
        typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, ' '),
        typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE, 1, 'u'),
@@ -111,9 +111,9 @@ ttab_t      ttab[NTSPEC] = {
        typeinfo("array", ARRAY, ARRAY, 0, 0, ' '),
        typeinfo("function", FUNC, FUNC, 0, 0, ' '),
 #ifdef DEBUG
-       typeinfo("_Complex", NOTSPEC, NOTSPEC, 0, 0, ' '),
+       typeinfo("_Complex", NO_TSPEC, NO_TSPEC, 0, 0, ' '),
 #else
-       typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, ' '),
+       typeinfo(NULL, NO_TSPEC, NO_TSPEC, 0, 0, ' '),
 #endif
        typeinfo("float _Complex", FCOMPLEX, FCOMPLEX,
            FLOAT_SIZE * 2, 32 * 2, 'c'),
diff -r a0e81e0f5a16 -r 21e47e0ebf99 usr.bin/xlint/common/lint.h
--- a/usr.bin/xlint/common/lint.h       Mon May 22 12:34:48 2023 +0000
+++ b/usr.bin/xlint/common/lint.h       Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lint.h,v 1.35 2022/02/07 21:57:47 rillig Exp $ */
+/*     $NetBSD: lint.h,v 1.36 2023/05/22 12:55:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -51,7 +51,7 @@
  * Type specifiers, used in type structures (type_t) and elsewhere.
  */
 typedef enum {
-       NOTSPEC = 0,
+       NO_TSPEC = 0,
        SIGNED,         /* keyword "signed", only used in the parser */
        UNSIGN,         /* keyword "unsigned", only used in the parser */
        BOOL,           /* _Bool */
diff -r a0e81e0f5a16 -r 21e47e0ebf99 usr.bin/xlint/lint1/ckbool.c
--- a/usr.bin/xlint/lint1/ckbool.c      Mon May 22 12:34:48 2023 +0000
+++ b/usr.bin/xlint/lint1/ckbool.c      Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ckbool.c,v 1.20 2023/01/21 20:07:01 rillig Exp $ */
+/* $NetBSD: ckbool.c,v 1.21 2023/05/22 12:55:04 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID)
-__RCSID("$NetBSD: ckbool.c,v 1.20 2023/01/21 20:07:01 rillig Exp $");
+__RCSID("$NetBSD: ckbool.c,v 1.21 2023/05/22 12:55:04 rillig Exp $");
 #endif
 
 #include <string.h>
@@ -151,7 +151,7 @@ typeok_scalar_strict_bool(op_t op, const
                rn = before_conversion(rn);
                rt = rn->tn_type->t_tspec;
        } else {
-               rt = NOTSPEC;
+               rt = NO_TSPEC;
        }
 
        if (rn != NULL &&
diff -r a0e81e0f5a16 -r 21e47e0ebf99 usr.bin/xlint/lint1/debug.c
--- a/usr.bin/xlint/lint1/debug.c       Mon May 22 12:34:48 2023 +0000
+++ b/usr.bin/xlint/lint1/debug.c       Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.30 2023/04/22 20:17:19 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.31 2023/05/22 12:55:04 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.30 2023/04/22 20:17:19 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.31 2023/05/22 12:55:04 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -382,13 +382,13 @@ debug_dinfo(const dinfo_t *d) // NOLINT(
        if (d->d_type != NULL) {
                debug_printf(" '%s'", type_name(d->d_type));
        } else {
-               if (d->d_abstract_type != NOTSPEC)
+               if (d->d_abstract_type != NO_TSPEC)
                        debug_printf(" %s", tspec_name(d->d_abstract_type));
-               if (d->d_complex_mod != NOTSPEC)
+               if (d->d_complex_mod != NO_TSPEC)
                        debug_printf(" %s", tspec_name(d->d_complex_mod));
-               if (d->d_sign_mod != NOTSPEC)
+               if (d->d_sign_mod != NO_TSPEC)
                        debug_printf(" %s", tspec_name(d->d_sign_mod));
-               if (d->d_rank_mod != NOTSPEC)
+               if (d->d_rank_mod != NO_TSPEC)
                        debug_printf(" %s", tspec_name(d->d_rank_mod));
        }
        if (d->d_redeclared_symbol != NULL)
diff -r a0e81e0f5a16 -r 21e47e0ebf99 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon May 22 12:34:48 2023 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon May 22 12:55:04 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.310 2023/04/25 19:00:57 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.311 2023/05/22 12:55:04 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.310 2023/04/25 19:00:57 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.311 2023/05/22 12:55:04 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -234,8 +234,8 @@ dcs_add_storage_class(scl_t sc)
                return;
        }
 
-       if (dcs->d_type != NULL || dcs->d_abstract_type != NOTSPEC ||
-           dcs->d_sign_mod != NOTSPEC || dcs->d_rank_mod != NOTSPEC) {
+       if (dcs->d_type != NULL || dcs->d_abstract_type != NO_TSPEC ||
+           dcs->d_sign_mod != NO_TSPEC || dcs->d_rank_mod != NO_TSPEC) {
                /* storage class after type is obsolescent */
                warning(83);
        }
@@ -268,9 +268,9 @@ dcs_add_type(type_t *tp)
                 * This should not happen with current grammar.
                 */
                lint_assert(dcs->d_type == NULL);
-               lint_assert(dcs->d_abstract_type == NOTSPEC);
-               lint_assert(dcs->d_sign_mod == NOTSPEC);
-               lint_assert(dcs->d_rank_mod == NOTSPEC);
+               lint_assert(dcs->d_abstract_type == NO_TSPEC);
+               lint_assert(dcs->d_sign_mod == NO_TSPEC);
+               lint_assert(dcs->d_rank_mod == NO_TSPEC);
 
                dcs->d_type = tp;
                return;
@@ -283,12 +283,12 @@ dcs_add_type(type_t *tp)
                 * something like "int struct a ..."
                 * struct/union/enum with anything else is not allowed
                 */
-               if (dcs->d_type != NULL || dcs->d_abstract_type != NOTSPEC ||
-                   dcs->d_rank_mod != NOTSPEC || dcs->d_sign_mod != NOTSPEC) {
+               if (dcs->d_type != NULL || dcs->d_abstract_type != NO_TSPEC ||
+                   dcs->d_rank_mod != NO_TSPEC || dcs->d_sign_mod != NO_TSPEC) {
                        dcs->d_invalid_type_combination = true;
-                       dcs->d_abstract_type = NOTSPEC;
-                       dcs->d_sign_mod = NOTSPEC;
-                       dcs->d_rank_mod = NOTSPEC;
+                       dcs->d_abstract_type = NO_TSPEC;
+                       dcs->d_sign_mod = NO_TSPEC;
+                       dcs->d_rank_mod = NO_TSPEC;
                }
                dcs->d_type = tp;
                return;
@@ -313,13 +313,13 @@ dcs_add_type(type_t *tp)
                        error(308);
                        t = DCOMPLEX; /* just as a fallback */
                }
-               dcs->d_complex_mod = NOTSPEC;
+               dcs->d_complex_mod = NO_TSPEC;
        }
 
        if (t == LONG && dcs->d_rank_mod == LONG) {
                /* "long long" or "long ... long" */
                t = QUAD;
-               dcs->d_rank_mod = NOTSPEC;
+               dcs->d_rank_mod = NO_TSPEC;
                if (!quadflg)
                        /* %s does not support 'long long' */
                        c99ism(265, allow_c90 ? "C90" : "traditional C");
@@ -337,7 +337,7 @@ dcs_add_type(type_t *tp)
                 * remember specifiers "signed" & "unsigned" in
                 * dcs->d_sign_mod
                 */
-               if (dcs->d_sign_mod != NOTSPEC)
+               if (dcs->d_sign_mod != NO_TSPEC)
                        /* more than one "signed" and/or "unsigned" */
                        dcs->d_invalid_type_combination = true;
                dcs->d_sign_mod = t;
@@ -346,17 +346,17 @@ dcs_add_type(type_t *tp)
                 * remember specifiers "short", "long" and "long long" in
                 * dcs->d_rank_mod
                 */
-               if (dcs->d_rank_mod != NOTSPEC)
+               if (dcs->d_rank_mod != NO_TSPEC)
                        dcs->d_invalid_type_combination = true;
                dcs->d_rank_mod = t;
        } else if (t == FLOAT || t == DOUBLE) {
-               if (dcs->d_rank_mod == NOTSPEC || dcs->d_rank_mod == LONG) {
-                       if (dcs->d_complex_mod != NOTSPEC
+               if (dcs->d_rank_mod == NO_TSPEC || dcs->d_rank_mod == LONG) {
+                       if (dcs->d_complex_mod != NO_TSPEC
                            || (t == FLOAT && dcs->d_rank_mod == LONG))
                                dcs->d_invalid_type_combination = true;
                        dcs->d_complex_mod = t;
                } else {
-                       if (dcs->d_abstract_type != NOTSPEC)
+                       if (dcs->d_abstract_type != NO_TSPEC)
                                dcs->d_invalid_type_combination = true;
                        dcs->d_abstract_type = t;
                }
@@ -367,7 +367,7 @@ dcs_add_type(type_t *tp)
                 * remember specifiers "void", "char", "int",
                 * or "_Complex" in dcs->d_abstract_type
                 */
-               if (dcs->d_abstract_type != NOTSPEC)
+               if (dcs->d_abstract_type != NO_TSPEC)
                        dcs->d_invalid_type_combination = true;
                dcs->d_abstract_type = t;
        }
@@ -684,10 +684,10 @@ void
 dcs_begin_type(void)
 {
 
-       dcs->d_abstract_type = NOTSPEC;
-       dcs->d_complex_mod = NOTSPEC;
-       dcs->d_sign_mod = NOTSPEC;
-       dcs->d_rank_mod = NOTSPEC;



Home | Main Index | Thread Index | Old Index