Module Name: src Committed By: rillig Date: Sun Jan 3 19:10:47 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: decl.c init.c lint1.h tree.c Log Message: lint: rename type.t_isfield to t_bitfield To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/init.c cvs rdiff -u -r1.49 -r1.50 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.119 -r1.120 src/usr.bin/xlint/lint1/tree.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/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.107 src/usr.bin/xlint/lint1/decl.c:1.108 --- src/usr.bin/xlint/lint1/decl.c:1.107 Sun Jan 3 18:48:37 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun Jan 3 19:10:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.107 2021/01/03 18:48:37 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.108 2021/01/03 19:10:47 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.107 2021/01/03 18:48:37 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.108 2021/01/03 19:10:47 rillig Exp $"); #endif #include <sys/param.h> @@ -494,7 +494,7 @@ static size_t bitfieldsize(sym_t **mem) { size_t len = (*mem)->s_type->t_flen; - while (*mem && (*mem)->s_type->t_isfield) { + while (*mem && (*mem)->s_type->t_bitfield) { len += (*mem)->s_type->t_flen; *mem = (*mem)->s_next; } @@ -513,7 +513,7 @@ setpackedsize(type_t *tp) sp = tp->t_str; sp->size = 0; for (mem = sp->memb; mem != NULL; mem = mem->s_next) { - if (mem->s_type->t_isfield) { + if (mem->s_type->t_bitfield) { sp->size += bitfieldsize(&mem); if (mem == NULL) break; @@ -1148,7 +1148,7 @@ declarator_1_struct_union(sym_t *dsym) if (dsym->s_scl == MOU) { /* illegal use of bit-field */ error(41); - dsym->s_type->t_isfield = 0; + dsym->s_type->t_bitfield = false; dsym->s_bitfield = 0; } } else if (t == FUNC) { @@ -1238,7 +1238,7 @@ bitfield(sym_t *dsym, int len) dsym->s_blklev = -1; } dsym->s_type = duptyp(dsym->s_type); - dsym->s_type->t_isfield = 1; + dsym->s_type->t_bitfield = true; dsym->s_type->t_flen = len; dsym->s_bitfield = 1; return dsym; @@ -1787,7 +1787,7 @@ complete_tag_struct_or_union(type_t *tp, /* bind anonymous members to the structure */ if (mem->s_styp == NULL) { mem->s_styp = sp; - if (mem->s_type->t_isfield) { + if (mem->s_type->t_bitfield) { sp->size += bitfieldsize(&mem); if (mem == NULL) break; Index: src/usr.bin/xlint/lint1/init.c diff -u src/usr.bin/xlint/lint1/init.c:1.58 src/usr.bin/xlint/lint1/init.c:1.59 --- src/usr.bin/xlint/lint1/init.c:1.58 Sun Jan 3 17:42:45 2021 +++ src/usr.bin/xlint/lint1/init.c Sun Jan 3 19:10:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.58 2021/01/03 17:42:45 rillig Exp $ */ +/* $NetBSD: init.c,v 1.59 2021/01/03 19:10:47 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: init.c,v 1.58 2021/01/03 17:42:45 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.59 2021/01/03 19:10:47 rillig Exp $"); #endif #include <stdlib.h> @@ -633,7 +633,7 @@ mkinit(tnode_t *tn) expr(tn, 1, 0, 1); trestor(tmem); - if (tspec_is_int(lt) && ln->tn_type->t_isfield && !tspec_is_int(rt)) { + if (tspec_is_int(lt) && ln->tn_type->t_bitfield && !tspec_is_int(rt)) { /* * Bit-fields can be initialized in trad. C only by integer * constants. @@ -643,7 +643,7 @@ mkinit(tnode_t *tn) warning(186); } - if (lt != rt || (initstk->i_type->t_isfield && tn->tn_op == CON)) + if (lt != rt || (initstk->i_type->t_bitfield && tn->tn_op == CON)) tn = convert(INIT, 0, initstk->i_type, tn); if (tn != NULL && tn->tn_op != CON) { Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.49 src/usr.bin/xlint/lint1/lint1.h:1.50 --- src/usr.bin/xlint/lint1/lint1.h:1.49 Sun Jan 3 18:48:37 2021 +++ src/usr.bin/xlint/lint1/lint1.h Sun Jan 3 19:10:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.49 2021/01/03 18:48:37 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.50 2021/01/03 19:10:47 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -156,7 +156,7 @@ struct type { 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_isfield : 1; /* type is bitfield */ + bool t_bitfield : 1; bool t_isenum : 1; /* type is (or was) enum (t_enum valid) */ bool t_ispacked : 1; /* type is packed */ union { Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.119 src/usr.bin/xlint/lint1/tree.c:1.120 --- src/usr.bin/xlint/lint1/tree.c:1.119 Sun Jan 3 18:35:51 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 3 19:10:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.119 2021/01/03 18:35:51 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.120 2021/01/03 19:10:47 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.119 2021/01/03 18:35:51 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.120 2021/01/03 19:10:47 rillig Exp $"); #endif #include <float.h> @@ -759,7 +759,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn * struct_or_union_member(). * Here we only must check for totally wrong things. */ - if (lt == FUNC || lt == VOID || ltp->t_isfield || + if (lt == FUNC || lt == VOID || ltp->t_bitfield || ((lt != STRUCT && lt != UNION) && !ln->tn_lvalue)) { /* Without tflag we got already an error */ if (tflag) @@ -815,7 +815,7 @@ typeok(op_t op, int arg, tnode_t *ln, tn error(114, "", mp->m_name); return 0; } else if (tspec_is_scalar(lt)) { - if (ltp->t_isfield) { + if (ltp->t_bitfield) { /* cannot take address of bit-field */ error(112); return 0; @@ -1530,7 +1530,7 @@ promote(op_t op, int farg, tnode_t *tn) * if INT can represent all possible values of the previous * type. */ - if (tn->tn_type->t_isfield) { + if (tn->tn_type->t_bitfield) { len = tn->tn_type->t_flen; if (size(INT) > len) { t = INT; @@ -2028,14 +2028,14 @@ cvtcon(op_t op, int arg, type_t *tp, val case LCOMPLEX: break; default: - sz = tp->t_isfield ? tp->t_flen : size(nt); + sz = tp->t_bitfield ? tp->t_flen : size(nt); nv->v_quad = xsign(nv->v_quad, nt, sz); break; } if (rchk && op != CVT) { osz = size(ot); - nsz = tp->t_isfield ? tp->t_flen : size(nt); + nsz = tp->t_bitfield ? tp->t_flen : size(nt); xmask = qlmasks[nsz] ^ qlmasks[osz]; xmsk1 = qlmasks[nsz] ^ qlmasks[osz - 1]; /* @@ -2107,13 +2107,13 @@ cvtcon(op_t op, int arg, type_t *tp, val * i = c; ** yields -128 ** * i = (unsigned char)c; ** yields 128 ** */ - if (op == ASSIGN && tp->t_isfield) { + if (op == ASSIGN && tp->t_bitfield) { /* precision lost in bit-field assignment */ warning(166); } else if (op == ASSIGN) { /* constant truncated by assignment */ warning(165); - } else if (op == INIT && tp->t_isfield) { + } else if (op == INIT && tp->t_bitfield) { /* bit-field initializer does not fit */ warning(180); } else if (op == INIT) { @@ -2132,10 +2132,10 @@ cvtcon(op_t op, int arg, type_t *tp, val type_name(gettyp(ot)), type_name(tp)); } } else if (nv->v_quad != v->v_quad) { - if (op == ASSIGN && tp->t_isfield) { + if (op == ASSIGN && tp->t_bitfield) { /* precision lost in bit-field assignment */ warning(166); - } else if (op == INIT && tp->t_isfield) { + } else if (op == INIT && tp->t_bitfield) { /* bit-field initializer out of range */ warning(11); } else if (op == CASE) { @@ -2309,7 +2309,7 @@ build_struct_access(op_t op, tnode_t *ln if (ln->tn_op == CON) ntn = fold(ntn); - if (rn->tn_type->t_isfield) { + if (rn->tn_type->t_bitfield) { ntn = new_tnode(FSEL, ntn->tn_type->t_subt, ntn, NULL); } else { ntn = new_tnode(STAR, ntn->tn_type->t_subt, ntn, NULL); @@ -2591,7 +2591,7 @@ build_assignment(op_t op, tnode_t *ln, t } else if (op != SHRASS) { if (op == ASSIGN || lt != PTR) { if (lt != rt || - (ln->tn_type->t_isfield && rn->tn_op == CON)) { + (ln->tn_type->t_bitfield && rn->tn_op == CON)) { rn = convert(op, 0, ln->tn_type, rn); rt = lt; } @@ -3046,7 +3046,7 @@ tsize(type_t *tp) } /* FALLTHROUGH */ default: - if (tp->t_isfield) { + if (tp->t_bitfield) { /* cannot take size/alignment of bit-field */ error(145); } @@ -3092,7 +3092,7 @@ build_alignof(type_t *tp) case ENUM: break; default: - if (tp->t_isfield) { + if (tp->t_bitfield) { /* cannot take size/alignment of bit-field */ error(145); return 0;