lint: rename dinfo_t.d_stralign to d_sou_align_in_bits

When talking about alignment, offset and size of a type, the measurement
unit must be mentioned in the variable name, especially when it differs
from the standard unit of measurement, which is a byte, not a bit.

No functional change.
This commit is contained in:
rillig 2021-07-05 19:48:32 +00:00
parent a25d70edb7
commit a3df5655f7
3 changed files with 12 additions and 11 deletions

View File

@ -1,5 +1,5 @@
%{
/* $NetBSD: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $ */
/* $NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 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: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $");
__RCSID("$NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $");
#endif
#include <limits.h>
@ -759,7 +759,7 @@ struct:
symtyp = FTAG;
begin_declaration_level($1 == STRUCT ? MOS : MOU);
dcs->d_offset = 0;
dcs->d_stralign = CHAR_SIZE;
dcs->d_sou_align_in_bits = CHAR_SIZE;
$$ = $1;
}
;

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $ */
/* $NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 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.193 2021/07/04 13:31:10 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $");
#endif
#include <sys/param.h>
@ -1255,8 +1255,8 @@ align(int al, int len)
* the struct/union if it is larger than the current alignment
* of the struct/union.
*/
if (al > dcs->d_stralign)
dcs->d_stralign = al;
if (al > dcs->d_sou_align_in_bits)
dcs->d_sou_align_in_bits = al;
no = (dcs->d_offset + (al - 1)) & ~(al - 1);
if (len == 0 || dcs->d_offset + len > no)
@ -1816,9 +1816,9 @@ complete_tag_struct_or_union(type_t *tp, sym_t *fmem)
setcomplete(tp, true);
t = tp->t_tspec;
align(dcs->d_stralign, 0);
align(dcs->d_sou_align_in_bits, 0);
sp = tp->t_str;
sp->sou_align_in_bits = dcs->d_stralign;
sp->sou_align_in_bits = dcs->d_sou_align_in_bits;
sp->sou_first_member = fmem;
if (tp->t_packed)
setpackedsize(tp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lint1.h,v 1.110 2021/07/04 09:13:59 rillig Exp $ */
/* $NetBSD: lint1.h,v 1.111 2021/07/05 19:48:32 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@ -361,7 +361,8 @@ typedef struct dinfo {
for all declarators */
sym_t *d_redeclared_symbol;
int d_offset; /* offset of next structure member */
int d_stralign; /* alignment required for current structure */
int d_sou_align_in_bits; /* alignment required for current
* structure */
scl_t d_ctx; /* context of declaration */
bool d_const : 1; /* const in declaration specifiers */
bool d_volatile : 1; /* volatile in declaration specifiers */