Module Name: src Committed By: rillig Date: Fri Feb 19 22:27:49 UTC 2021
Modified Files: src/usr.bin/xlint/common: tyname.c src/usr.bin/xlint/lint1: decl.c emit1.c func.c lint1.h tree.c src/usr.bin/xlint/lint2: chk.c emit2.c lint2.h read.c Log Message: lint: rename t_isenum and t_aincompl to be more expressive No functional change. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/common/tyname.c cvs rdiff -u -r1.135 -r1.136 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/emit1.c cvs rdiff -u -r1.70 -r1.71 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.208 -r1.209 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.37 -r1.38 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/xlint/lint2/emit2.c cvs rdiff -u -r1.12 -r1.13 src/usr.bin/xlint/lint2/lint2.h cvs rdiff -u -r1.38 -r1.39 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/tyname.c diff -u src/usr.bin/xlint/common/tyname.c:1.28 src/usr.bin/xlint/common/tyname.c:1.29 --- src/usr.bin/xlint/common/tyname.c:1.28 Fri Feb 19 22:20:18 2021 +++ src/usr.bin/xlint/common/tyname.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 rillig Exp $ */ +/* $NetBSD: tyname.c,v 1.29 2021/02/19 22:27:49 rillig Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tyname.c,v 1.28 2021/02/19 22:20:18 rillig Exp $"); +__RCSID("$NetBSD: tyname.c,v 1.29 2021/02/19 22:27:49 rillig Exp $"); #endif #include <limits.h> @@ -294,7 +294,7 @@ type_name(const type_t *tp) * XXX: Why is this necessary, and in which cases does this apply? * Shouldn't the type be an ENUM from the beginning? */ - if ((t = tp->t_tspec) == INT && tp->t_isenum) + if ((t = tp->t_tspec) == INT && tp->t_is_enum) t = ENUM; buf_init(&buf); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.135 src/usr.bin/xlint/lint1/decl.c:1.136 --- src/usr.bin/xlint/lint1/decl.c:1.135 Fri Feb 19 22:20:18 2021 +++ src/usr.bin/xlint/lint1/decl.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.135 2021/02/19 22:20:18 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.136 2021/02/19 22:27:49 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.135 2021/02/19 22:20:18 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.136 2021/02/19 22:27:49 rillig Exp $"); #endif #include <sys/param.h> @@ -179,7 +179,7 @@ is_incomplete(const type_t *tp) if ((t = tp->t_tspec) == VOID) { return true; } else if (t == ARRAY) { - return tp->t_aincompl; + return tp->t_incomplete_array; } else if (t == STRUCT || t == UNION) { return tp->t_str->sou_incomplete; } else if (t == ENUM) { @@ -197,7 +197,7 @@ setcomplete(type_t *tp, bool complete) tspec_t t; if ((t = tp->t_tspec) == ARRAY) { - tp->t_aincompl = !complete; + tp->t_incomplete_array = !complete; } else if (t == STRUCT || t == UNION) { tp->t_str->sou_incomplete = !complete; } else { @@ -1665,7 +1665,7 @@ mktag(sym_t *tag, tspec_t kind, bool dec tp->t_str->sou_align_in_bit = CHAR_SIZE; tp->t_str->sou_tag = tag; } else { - tp->t_isenum = true; + tp->t_is_enum = true; tp->t_enum = getblk(sizeof(*tp->t_enum)); tp->t_enum->en_tag = tag; } Index: src/usr.bin/xlint/lint1/emit1.c diff -u src/usr.bin/xlint/lint1/emit1.c:1.41 src/usr.bin/xlint/lint1/emit1.c:1.42 --- src/usr.bin/xlint/lint1/emit1.c:1.41 Fri Feb 19 22:20:18 2021 +++ src/usr.bin/xlint/lint1/emit1.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit1.c,v 1.41 2021/02/19 22:20:18 rillig Exp $ */ +/* $NetBSD: emit1.c,v 1.42 2021/02/19 22:27:49 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: emit1.c,v 1.41 2021/02/19 22:20:18 rillig Exp $"); +__RCSID("$NetBSD: emit1.c,v 1.42 2021/02/19 22:27:49 rillig Exp $"); #endif #include <ctype.h> @@ -99,7 +99,7 @@ outtype(const type_t *tp) tspec_t ts; while (tp != NULL) { - if ((ts = tp->t_tspec) == INT && tp->t_isenum) + if ((ts = tp->t_tspec) == INT && tp->t_is_enum) ts = ENUM; switch (ts) { case BOOL: t = 'B'; s = '\0'; break; Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.70 src/usr.bin/xlint/lint1/func.c:1.71 --- src/usr.bin/xlint/lint1/func.c:1.70 Fri Feb 19 22:20:18 2021 +++ src/usr.bin/xlint/lint1/func.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.70 2021/02/19 22:20:18 rillig Exp $ */ +/* $NetBSD: func.c,v 1.71 2021/02/19 22:27:49 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: func.c,v 1.70 2021/02/19 22:20:18 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.71 2021/02/19 22:27:49 rillig Exp $"); #endif #include <stdlib.h> @@ -637,7 +637,7 @@ switch1(tnode_t *tn) tp = xcalloc(1, sizeof (type_t)); if (tn != NULL) { tp->t_tspec = tn->tn_type->t_tspec; - if ((tp->t_isenum = tn->tn_type->t_isenum) != false) + if ((tp->t_is_enum = tn->tn_type->t_is_enum) != false) tp->t_enum = tn->tn_type->t_enum; } else { tp->t_tspec = INT; @@ -671,7 +671,7 @@ switch2(void) * labels and the number of enumerators. If both counts are not * equal print a warning. */ - if (cstmt->c_swtype->t_isenum) { + if (cstmt->c_swtype->t_is_enum) { nenum = nclab = 0; lint_assert(cstmt->c_swtype->t_enum != NULL); for (esym = cstmt->c_swtype->t_enum->en_first_enumerator; @@ -695,7 +695,7 @@ switch2(void) */ reached = true; } else if (!cstmt->c_default && - (!hflag || !cstmt->c_swtype->t_isenum || nenum != nclab)) { + (!hflag || !cstmt->c_swtype->t_is_enum || nenum != nclab)) { /* * there are possible values which are not handled in * switch Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.63 src/usr.bin/xlint/lint1/lint1.h:1.64 --- src/usr.bin/xlint/lint1/lint1.h:1.63 Fri Feb 19 22:20:18 2021 +++ src/usr.bin/xlint/lint1/lint1.h Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.63 2021/02/19 22:20:18 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.64 2021/02/19 22:27:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -150,14 +150,14 @@ typedef struct { */ struct type { tspec_t t_tspec; /* type specifier */ - bool t_aincompl : 1; /* incomplete array type */ + bool t_incomplete_array : 1; bool t_const : 1; /* const modifier */ bool t_volatile : 1; /* volatile modifier */ bool t_proto : 1; /* function prototype (t_args valid) */ bool t_vararg : 1; /* prototype with '...' */ bool t_typedef : 1; /* type defined with typedef */ bool t_bitfield : 1; - bool t_isenum : 1; /* type is (or was) enum (t_enum valid) */ + bool t_is_enum : 1; /* type is (or was) enum (t_enum valid) */ bool t_packed : 1; union { int _t_dim; /* dimension */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.208 src/usr.bin/xlint/lint1/tree.c:1.209 --- src/usr.bin/xlint/lint1/tree.c:1.208 Fri Feb 19 22:16:12 2021 +++ src/usr.bin/xlint/lint1/tree.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.208 2021/02/19 22:16:12 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.209 2021/02/19 22:27:49 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: tree.c,v 1.208 2021/02/19 22:16:12 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.209 2021/02/19 22:27:49 rillig Exp $"); #endif #include <float.h> @@ -1456,13 +1456,13 @@ typeok_enum(op_t op, const mod_t *mp, in const tnode_t *rn, const type_t *rtp) { if (mp->m_bad_on_enum && - (ltp->t_isenum || (mp->m_binary && rtp->t_isenum))) { + (ltp->t_is_enum || (mp->m_binary && rtp->t_is_enum))) { check_bad_enum_operation(op, ln, rn); } else if (mp->m_valid_on_enum && - (ltp->t_isenum && rtp != NULL && rtp->t_isenum)) { + (ltp->t_is_enum && rtp != NULL && rtp->t_is_enum)) { check_enum_type_mismatch(op, arg, ln, rn); } else if (mp->m_valid_on_enum && - (ltp->t_isenum || (rtp != NULL && rtp->t_isenum))) { + (ltp->t_is_enum || (rtp != NULL && rtp->t_is_enum))) { check_enum_int_mismatch(op, arg, ln, rn); } } @@ -1692,8 +1692,8 @@ check_bad_enum_operation(op_t op, const mp = &modtab[op]; - if (!(ln->tn_type->t_isenum || - (mp->m_binary && rn->tn_type->t_isenum))) { + if (!(ln->tn_type->t_is_enum || + (mp->m_binary && rn->tn_type->t_is_enum))) { return; } @@ -1702,8 +1702,8 @@ check_bad_enum_operation(op_t op, const * could not be used as array indices). */ if (op == PLUS && - ((ln->tn_type->t_isenum && rn->tn_type->t_tspec == PTR) || - (rn->tn_type->t_isenum && ln->tn_type->t_tspec == PTR))) { + ((ln->tn_type->t_is_enum && rn->tn_type->t_tspec == PTR) || + (rn->tn_type->t_is_enum && ln->tn_type->t_tspec == PTR))) { return; } @@ -1764,7 +1764,7 @@ check_enum_int_mismatch(op_t op, int arg * Initialization with 0 is allowed. Otherwise, all implicit * initializations would need to be warned upon as well. */ - if (!rn->tn_type->t_isenum && rn->tn_op == CON && + if (!rn->tn_type->t_is_enum && rn->tn_op == CON && is_integer(rn->tn_type->t_tspec) && rn->tn_val->v_quad == 0) { return; @@ -1929,7 +1929,7 @@ promote(op_t op, bool farg, tnode_t *tn) ntp = tduptyp(tn->tn_type); ntp->t_tspec = t; /* - * Keep t_isenum so we are later able to check compatibility + * Keep t_is_enum so we are later able to check compatibility * of enum types. */ tn = convert(op, 0, ntp, tn); @@ -3622,7 +3622,7 @@ check_function_arguments(type_t *ftp, tn error(152, n); return NULL; } else if (is_integer(at) && - arg->tn_left->tn_type->t_isenum && + arg->tn_left->tn_type->t_is_enum && is_incomplete(arg->tn_left->tn_type)) { /* argument cannot have unknown size, arg #%d */ warning(152, n); Index: src/usr.bin/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.37 src/usr.bin/xlint/lint2/chk.c:1.38 --- src/usr.bin/xlint/lint2/chk.c:1.37 Sun Jan 24 00:15:20 2021 +++ src/usr.bin/xlint/lint2/chk.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.37 2021/01/24 00:15:20 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.38 2021/02/19 22:27:49 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: chk.c,v 1.37 2021/01/24 00:15:20 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.38 2021/02/19 22:27:49 rillig Exp $"); #endif #include <ctype.h> @@ -496,7 +496,7 @@ chkau(hte_t *hte, int n, sym_t *def, sym t1 = arg1->t_tspec; t2 = arg2->t_tspec; if (is_integer(t1) && is_integer(t2) && - !arg1->t_isenum && !arg2->t_isenum) { + !arg1->t_is_enum && !arg2->t_is_enum) { if (promote) { /* * XXX Here is a problem: Although it is possible to @@ -1244,7 +1244,7 @@ eqtype(type_t *tp1, type_t *tp2, bool ig return false; } - if (tp1->t_isenum && tp2->t_isenum) { + if (tp1->t_is_enum && tp2->t_is_enum) { if (tp1->t_istag && tp2->t_istag) { return tp1->t_tag == tp2->t_tag; } else if (tp1->t_istynam && tp2->t_istynam) { Index: src/usr.bin/xlint/lint2/emit2.c diff -u src/usr.bin/xlint/lint2/emit2.c:1.15 src/usr.bin/xlint/lint2/emit2.c:1.16 --- src/usr.bin/xlint/lint2/emit2.c:1.15 Wed Dec 30 10:26:12 2020 +++ src/usr.bin/xlint/lint2/emit2.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit2.c,v 1.15 2020/12/30 10:26:12 rillig Exp $ */ +/* $NetBSD: emit2.c,v 1.16 2021/02/19 22:27:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -34,7 +34,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: emit2.c,v 1.15 2020/12/30 10:26:12 rillig Exp $"); +__RCSID("$NetBSD: emit2.c,v 1.16 2021/02/19 22:27:49 rillig Exp $"); #endif #include "lint2.h" @@ -55,7 +55,7 @@ outtype(type_t *tp) type_t **ap; while (tp != NULL) { - if ((ts = tp->t_tspec) == INT && tp->t_isenum) + if ((ts = tp->t_tspec) == INT && tp->t_is_enum) ts = ENUM; switch (ts) { case BOOL: t = 'B'; s = '\0'; break; Index: src/usr.bin/xlint/lint2/lint2.h diff -u src/usr.bin/xlint/lint2/lint2.h:1.12 src/usr.bin/xlint/lint2/lint2.h:1.13 --- src/usr.bin/xlint/lint2/lint2.h:1.12 Sat Jan 2 01:06:15 2021 +++ src/usr.bin/xlint/lint2/lint2.h Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint2.h,v 1.12 2021/01/02 01:06:15 rillig Exp $ */ +/* $NetBSD: lint2.h,v 1.13 2021/02/19 22:27:49 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -42,7 +42,7 @@ struct type { bool t_const : 1; /* constant */ bool t_volatile : 1; /* volatile */ bool t_vararg : 1; /* function has variable number of arguments */ - bool t_isenum : 1; /* enum type */ + bool t_is_enum : 1; bool t_proto : 1; /* this is a prototype */ bool t_istag : 1; /* tag with _t_tag valid */ bool t_istynam : 1; /* tag with _t_tynam valid */ @@ -51,9 +51,9 @@ struct type { int _t_dim; /* if the type is an ARRAY than this is the dimension of the array. */ struct hte *_t_tag; /* hash table entry of tag if - t_isenum, STRUCT or UNION */ + t_is_enum, STRUCT or UNION */ struct hte *_t_tynam; /* hash table entry of typename if - t_isenum, STRUCT or UNION */ + t_is_enum, STRUCT or UNION */ struct { int p_line; short p_file; Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.38 src/usr.bin/xlint/lint2/read.c:1.39 --- src/usr.bin/xlint/lint2/read.c:1.38 Sat Jan 16 16:53:24 2021 +++ src/usr.bin/xlint/lint2/read.c Fri Feb 19 22:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.38 2021/01/16 16:53:24 rillig Exp $ */ +/* $NetBSD: read.c,v 1.39 2021/02/19 22:27:49 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.38 2021/01/16 16:53:24 rillig Exp $"); +__RCSID("$NetBSD: read.c,v 1.39 2021/02/19 22:27:49 rillig Exp $"); #endif #include <ctype.h> @@ -680,7 +680,7 @@ inptype(const char *cp, const char **epp break; case ENUM: tp->t_tspec = INT; - tp->t_isenum = true; + tp->t_is_enum = true; /* FALLTHROUGH */ case STRUCT: case UNION: