Module Name: src
Committed By: rillig
Date: Mon May 22 12:55:04 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: decl_struct_member.c msg_108.c
src/tests/usr.bin/xlint/lint2: read.ln
src/usr.bin/xlint/common: inittyp.c lint.h
src/usr.bin/xlint/lint1: ckbool.c debug.c decl.c tree.c
src/usr.bin/xlint/lint2: chk.c read.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/decl_struct_member.c
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_108.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint2/read.ln
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/inittyp.c
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/xlint/common/lint.h
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/xlint/lint1/ckbool.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.310 -r1.311 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.523 -r1.524 src/usr.bin/xlint/lint1/tree.c
cvs rdiff -u -r1.53 -r1.54 src/usr.bin/xlint/lint2/chk.c
cvs rdiff -u -r1.79 -r1.80 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/tests/usr.bin/xlint/lint1/decl_struct_member.c
diff -u src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.16 src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.17
--- src/tests/usr.bin/xlint/lint1/decl_struct_member.c:1.16 Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/decl_struct_member.c Mon May 22 12:55:04 2023
@@ -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] */
Index: src/tests/usr.bin/xlint/lint1/msg_108.c
diff -u src/tests/usr.bin/xlint/lint1/msg_108.c:1.7 src/tests/usr.bin/xlint/lint1/msg_108.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_108.c:1.7 Tue Jun 21 21:18:30 2022
+++ src/tests/usr.bin/xlint/lint1/msg_108.c Mon May 22 12:55:04 2023
@@ -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.
Index: src/tests/usr.bin/xlint/lint2/read.ln
diff -u src/tests/usr.bin/xlint/lint2/read.ln:1.5 src/tests/usr.bin/xlint/lint2/read.ln:1.6
--- src/tests/usr.bin/xlint/lint2/read.ln:1.5 Mon Aug 30 21:23:37 2021
+++ src/tests/usr.bin/xlint/lint2/read.ln Mon May 22 12:55:04 2023
@@ -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);
Index: src/usr.bin/xlint/common/inittyp.c
diff -u src/usr.bin/xlint/common/inittyp.c:1.33 src/usr.bin/xlint/common/inittyp.c:1.34
--- src/usr.bin/xlint/common/inittyp.c:1.33 Wed Nov 30 20:50:22 2022
+++ src/usr.bin/xlint/common/inittyp.c Mon May 22 12:55:04 2023
@@ -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 @@ __RCSID("$NetBSD: inittyp.c,v 1.33 2022/
/* 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'),
Index: src/usr.bin/xlint/common/lint.h
diff -u src/usr.bin/xlint/common/lint.h:1.35 src/usr.bin/xlint/common/lint.h:1.36
--- src/usr.bin/xlint/common/lint.h:1.35 Mon Feb 7 21:57:47 2022
+++ src/usr.bin/xlint/common/lint.h Mon May 22 12:55:04 2023
@@ -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 */
Index: src/usr.bin/xlint/lint1/ckbool.c
diff -u src/usr.bin/xlint/lint1/ckbool.c:1.20 src/usr.bin/xlint/lint1/ckbool.c:1.21
--- src/usr.bin/xlint/lint1/ckbool.c:1.20 Sat Jan 21 20:07:01 2023
+++ src/usr.bin/xlint/lint1/ckbool.c Mon May 22 12:55:04 2023
@@ -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 &&
Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.30 src/usr.bin/xlint/lint1/debug.c:1.31
--- src/usr.bin/xlint/lint1/debug.c:1.30 Sat Apr 22 20:17:19 2023
+++ src/usr.bin/xlint/lint1/debug.c Mon May 22 12:55:04 2023
@@ -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)
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.310 src/usr.bin/xlint/lint1/decl.c:1.311
--- src/usr.bin/xlint/lint1/decl.c:1.310 Tue Apr 25 19:00:57 2023
+++ src/usr.bin/xlint/lint1/decl.c Mon May 22 12:55:04 2023
@@ -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;
+ dcs->d_abstract_type = NO_TSPEC;
+ dcs->d_complex_mod = NO_TSPEC;
+ dcs->d_sign_mod = NO_TSPEC;
+ dcs->d_rank_mod = NO_TSPEC;
dcs->d_scl = NOSCL;
dcs->d_type = NULL;
dcs->d_const = false;
@@ -736,37 +736,37 @@ dcs_merge_declaration_specifiers(void)
tp = dcs->d_type;
debug_step("%s: %s", __func__, type_name(tp));
- if (t == NOTSPEC && s == NOTSPEC && l == NOTSPEC && c == NOTSPEC &&
+ if (t == NO_TSPEC && s == NO_TSPEC && l == NO_TSPEC && c == NO_TSPEC &&
tp == NULL)
dcs->d_notyp = true;
- if (t == NOTSPEC && s == NOTSPEC && (l == NOTSPEC || l == LONG) &&
+ if (t == NO_TSPEC && s == NO_TSPEC && (l == NO_TSPEC || l == LONG) &&
tp == NULL)
t = c;
if (tp != NULL) {
- lint_assert(t == NOTSPEC);
- lint_assert(s == NOTSPEC);
- lint_assert(l == NOTSPEC);
+ lint_assert(t == NO_TSPEC);
+ lint_assert(s == NO_TSPEC);
+ lint_assert(l == NO_TSPEC);
return;
}
- if (t == NOTSPEC)
+ if (t == NO_TSPEC)
t = INT;
- if (s == NOTSPEC && t == INT)
+ if (s == NO_TSPEC && t == INT)
s = SIGNED;
- if (l != NOTSPEC && t == CHAR) {
+ if (l != NO_TSPEC && t == CHAR) {
dcs->d_invalid_type_combination = true;
- l = NOTSPEC;
+ l = NO_TSPEC;
}
if (l == LONG && t == FLOAT) {
- l = NOTSPEC;
+ l = NO_TSPEC;
t = DOUBLE;
if (allow_c90)
/* use 'double' instead of 'long float' */
warning(6);
}
if ((l == LONG && t == DOUBLE) || t == LDOUBLE) {
- l = NOTSPEC;
+ l = NO_TSPEC;
t = LDOUBLE;
}
if (t == LDOUBLE && !allow_c90) {
@@ -774,15 +774,15 @@ dcs_merge_declaration_specifiers(void)
warning(266);
}
if (l == LONG && t == DCOMPLEX) {
- l = NOTSPEC;
+ l = NO_TSPEC;
t = LCOMPLEX;
}
- if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
+ if (t != INT && t != CHAR && (s != NO_TSPEC || l != NO_TSPEC)) {
dcs->d_invalid_type_combination = true;
- l = s = NOTSPEC;
+ l = s = NO_TSPEC;
}
- if (l != NOTSPEC)
+ if (l != NO_TSPEC)
t = l;
dcs->d_type = gettyp(merge_signedness(t, s));
}
@@ -943,7 +943,7 @@ check_type(sym_t *sym)
type_t **tpp, *tp;
tpp = &sym->s_type;
- to = NOTSPEC;
+ to = NO_TSPEC;
while ((tp = *tpp) != NULL) {
t = tp->t_tspec;
/*
@@ -951,7 +951,7 @@ check_type(sym_t *sym)
* a better warning is printed in begin_function().
*/
if (t == FUNC && !tp->t_proto &&
- !(to == NOTSPEC && sym->s_osdef)) {
+ !(to == NO_TSPEC && sym->s_osdef)) {
/* TODO: Make this an error in C99 mode as well. */
if ((!allow_trad && !allow_c99) && hflag)
/* function declaration is not a prototype */
@@ -993,7 +993,7 @@ check_type(sym_t *sym)
* No need to check for incomplete types here as
* length_in_bits already does this.
*/
- } else if (to == NOTSPEC && t == VOID) {
+ } else if (to == NO_TSPEC && t == VOID) {
if (dcs->d_kind == DK_PROTO_ARG) {
if (sym->s_scl != ABSTRACT) {
lint_assert(sym->s_name != unnamed);
@@ -1054,7 +1054,7 @@ check_bit_field_type(sym_t *dsym, type_t
warning(34, type_name(btp));
}
}
- } else if (t == INT && dcs->d_sign_mod == NOTSPEC) {
+ } else if (t == INT && dcs->d_sign_mod == NO_TSPEC) {
if (pflag && !bitfieldtype_ok) {
/* bit-field of type plain 'int' has ... */
warning(344);
@@ -1714,7 +1714,7 @@ make_tag_type(sym_t *tag, tspec_t kind,
dcs->d_enclosing->d_nonempty_decl = true;
}
- if (tp->t_tspec == NOTSPEC) {
+ if (tp->t_tspec == NO_TSPEC) {
tp->t_tspec = kind;
if (kind != ENUM) {
tp->t_sou = block_zero_alloc(sizeof(*tp->t_sou));
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.523 src/usr.bin/xlint/lint1/tree.c:1.524
--- src/usr.bin/xlint/lint1/tree.c:1.523 Sat May 13 20:55:44 2023
+++ src/usr.bin/xlint/lint1/tree.c Mon May 22 12:55:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.523 2023/05/13 20:55:44 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.524 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: tree.c,v 1.523 2023/05/13 20:55:44 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.524 2023/05/22 12:55:04 rillig Exp $");
#endif
#include <float.h>
@@ -2205,7 +2205,7 @@ warn_incompatible_types(op_t op,
/* operands of '%s' have incompatible types '%s' and '%s' */
error(107, mp->m_name, tspec_name(lt), tspec_name(rt));
} else {
- lint_assert(rt == NOTSPEC);
+ lint_assert(rt == NO_TSPEC);
/* operand of '%s' has invalid type '%s' */
error(108, mp->m_name, type_name(ltp));
}
@@ -2869,7 +2869,7 @@ static bool
check_assign_types_compatible(op_t op, int arg,
const tnode_t *ln, const tnode_t *rn)
{
- tspec_t lt, rt, lst = NOTSPEC, rst = NOTSPEC;
+ tspec_t lt, rt, lst = NO_TSPEC, rst = NO_TSPEC;
type_t *ltp, *rtp, *lstp = NULL, *rstp = NULL;
if ((lt = (ltp = ln->tn_type)->t_tspec) == PTR)
@@ -3201,7 +3201,7 @@ typeok(op_t op, int arg, const tnode_t *
rt = rtp->t_tspec;
} else {
rtp = NULL;
- rt = NOTSPEC;
+ rt = NO_TSPEC;
}
if (Tflag && !typeok_scalar_strict_bool(op, mp, arg, ln, rn))
Index: src/usr.bin/xlint/lint2/chk.c
diff -u src/usr.bin/xlint/lint2/chk.c:1.53 src/usr.bin/xlint/lint2/chk.c:1.54
--- src/usr.bin/xlint/lint2/chk.c:1.53 Sat Jan 14 08:48:18 2023
+++ src/usr.bin/xlint/lint2/chk.c Mon May 22 12:55:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.53 2023/01/14 08:48:18 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.54 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: chk.c,v 1.53 2023/01/14 08:48:18 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.54 2023/05/22 12:55:04 rillig Exp $");
#endif
#include <ctype.h>
@@ -610,7 +610,7 @@ printflike(const hte_t *hte, fcall_t *ca
const char *fp;
char fc;
bool fwidth, prec, left, sign, space, alt, zero;
- tspec_t sz, t1, t2 = NOTSPEC;
+ tspec_t sz, t1, t2 = NO_TSPEC;
type_t *tp;
fp = fmt;
@@ -628,7 +628,7 @@ printflike(const hte_t *hte, fcall_t *ca
}
fc = *fp++;
fwidth = prec = left = sign = space = alt = zero = false;
- sz = NOTSPEC;
+ sz = NO_TSPEC;
/* Flags */
for (;;) {
@@ -704,11 +704,11 @@ printflike(const hte_t *hte, fcall_t *ca
} else if (fc == 'L') {
sz = LDOUBLE;
}
- if (sz != NOTSPEC)
+ if (sz != NO_TSPEC)
fc = *fp++;
if (fc == '%') {
- if (sz != NOTSPEC || left || sign || space ||
+ if (sz != NO_TSPEC || left || sign || space ||
alt || zero || prec || fwidth) {
bad_format_string(hte, call);
}
@@ -768,7 +768,7 @@ printflike(const hte_t *hte, fcall_t *ca
inconsistent_arguments(hte, call, n);
}
} else if (fc == 'D' || fc == 'O' || fc == 'U') {
- if ((alt && fc != 'O') || sz != NOTSPEC || !tflag)
+ if ((alt && fc != 'O') || sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = LONG;
if (fc == 'D') {
@@ -778,26 +778,26 @@ printflike(const hte_t *hte, fcall_t *ca
}
} else if (fc == 'f' || fc == 'e' || fc == 'E' ||
fc == 'g' || fc == 'G') {
- if (sz == NOTSPEC)
+ if (sz == NO_TSPEC)
sz = DOUBLE;
if (sz != DOUBLE && sz != LDOUBLE)
bad_format_string(hte, call);
if (t1 != sz)
inconsistent_arguments(hte, call, n);
} else if (fc == 'c') {
- if (sz != NOTSPEC || alt || zero)
+ if (sz != NO_TSPEC || alt || zero)
bad_format_string(hte, call);
if (t1 != INT)
inconsistent_arguments(hte, call, n);
} else if (fc == 's') {
- if (sz != NOTSPEC || alt || zero)
+ if (sz != NO_TSPEC || alt || zero)
bad_format_string(hte, call);
if (t1 != PTR ||
(t2 != CHAR && t2 != UCHAR && t2 != SCHAR)) {
inconsistent_arguments(hte, call, n);
}
} else if (fc == 'p') {
- if (fwidth || prec || sz != NOTSPEC || alt || zero)
+ if (fwidth || prec || sz != NO_TSPEC || alt || zero)
bad_format_string(hte, call);
if (t1 != PTR || (hflag && t2 != VOID))
inconsistent_arguments(hte, call, n);
@@ -835,7 +835,7 @@ scanflike(const hte_t *hte, fcall_t *cal
const char *fp;
char fc;
bool noasgn, fwidth;
- tspec_t sz, t1 = NOTSPEC, t2 = NOTSPEC;
+ tspec_t sz, t1 = NO_TSPEC, t2 = NO_TSPEC;
type_t *tp = NULL;
fp = fmt;
@@ -854,7 +854,7 @@ scanflike(const hte_t *hte, fcall_t *cal
fc = *fp++;
noasgn = fwidth = false;
- sz = NOTSPEC;
+ sz = NO_TSPEC;
if (fc == '*') {
noasgn = true;
@@ -875,11 +875,11 @@ scanflike(const hte_t *hte, fcall_t *cal
} else if (fc == 'L') {
sz = LDOUBLE;
}
- if (sz != NOTSPEC)
+ if (sz != NO_TSPEC)
fc = *fp++;
if (fc == '%') {
- if (sz != NOTSPEC || noasgn || fwidth)
+ if (sz != NO_TSPEC || noasgn || fwidth)
bad_format_string(hte, call);
fc = *fp++;
continue;
@@ -926,12 +926,12 @@ scanflike(const hte_t *hte, fcall_t *cal
}
goto conv;
} else if (fc == 'D') {
- if (sz != NOTSPEC || !tflag)
+ if (sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = LONG;
goto conv;
} else if (fc == 'O') {
- if (sz != NOTSPEC || !tflag)
+ if (sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = ULONG;
goto conv;
@@ -940,7 +940,7 @@ scanflike(const hte_t *hte, fcall_t *cal
* XXX valid in ANSI C, but in NetBSD's libc imple-
* mented as "lx". That's why it should be avoided.
*/
- if (sz != NOTSPEC || !tflag)
+ if (sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = ULONG;
goto conv;
@@ -949,13 +949,13 @@ scanflike(const hte_t *hte, fcall_t *cal
* XXX valid in ANSI C, but in NetBSD's libc imple-
* mented as "lf". That's why it should be avoided.
*/
- if (sz != NOTSPEC || !tflag)
+ if (sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = DOUBLE;
goto conv;
} else if (fc == 'F') {
/* XXX only for backward compatibility */
- if (sz != NOTSPEC || !tflag)
+ if (sz != NO_TSPEC || !tflag)
bad_format_string(hte, call);
sz = DOUBLE;
goto conv;
@@ -964,12 +964,12 @@ scanflike(const hte_t *hte, fcall_t *cal
* XXX valid in ANSI C, but in NetBSD's libc not
* implemented
*/
- if (sz != NOTSPEC && sz != LONG && sz != LDOUBLE)
+ if (sz != NO_TSPEC && sz != LONG && sz != LDOUBLE)
bad_format_string(hte, call);
goto fconv;
} else if (fc == 'e' || fc == 'f' || fc == 'g') {
fconv:
- if (sz == NOTSPEC) {
+ if (sz == NO_TSPEC) {
sz = FLOAT;
} else if (sz == LONG) {
sz = DOUBLE;
@@ -979,7 +979,7 @@ scanflike(const hte_t *hte, fcall_t *cal
}
goto conv;
} else if (fc == 's' || fc == '[' || fc == 'c') {
- if (sz != NOTSPEC)
+ if (sz != NO_TSPEC)
bad_format_string(hte, call);
if (fc == '[') {
if ((fc = *fp++) == '-') {
@@ -1001,7 +1001,7 @@ scanflike(const hte_t *hte, fcall_t *cal
}
}
} else if (fc == 'p') {
- if (sz != NOTSPEC)
+ if (sz != NO_TSPEC)
bad_format_string(hte, call);
if (!noasgn) {
if (t1 != PTR || t2 != PTR) {
@@ -1213,7 +1213,7 @@ types_compatible(type_t *tp1, type_t *tp
tspec_t t, to;
int indir;
- to = NOTSPEC;
+ to = NO_TSPEC;
indir = 0;
while (tp1 != NULL && tp2 != NULL) {
Index: src/usr.bin/xlint/lint2/read.c
diff -u src/usr.bin/xlint/lint2/read.c:1.79 src/usr.bin/xlint/lint2/read.c:1.80
--- src/usr.bin/xlint/lint2/read.c:1.79 Tue Feb 21 19:30:51 2023
+++ src/usr.bin/xlint/lint2/read.c Mon May 22 12:55:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.79 2023/02/21 19:30:51 rillig Exp $ */
+/* $NetBSD: read.c,v 1.80 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: read.c,v 1.79 2023/02/21 19:30:51 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.80 2023/05/22 12:55:04 rillig Exp $");
#endif
#include <ctype.h>
@@ -780,7 +780,7 @@ gettlen(const char *cp, const char **epp
break;
}
- t = NOTSPEC;
+ t = NO_TSPEC;
switch (c) {
case 'B':
@@ -872,7 +872,7 @@ gettlen(const char *cp, const char **epp
break;
}
- if (t == NOTSPEC)
+ if (t == NO_TSPEC)
inperr("bad type: %c %c", c, s);
switch (t) {