lint: rename getbound to alignment_in_bits

No functional change.
This commit is contained in:
rillig 2021-02-28 00:23:55 +00:00
parent 1a77a0d07b
commit 2659adfbbb
3 changed files with 12 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl.c,v 1.138 2021/02/22 15:09:50 rillig Exp $ */
/* $NetBSD: decl.c,v 1.139 2021/02/28 00:23:55 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.138 2021/02/22 15:09:50 rillig Exp $");
__RCSID("$NetBSD: decl.c,v 1.139 2021/02/28 00:23:55 rillig Exp $");
#endif
#include <sys/param.h>
@ -925,11 +925,8 @@ length(const type_t *tp, const char *name)
return elem * elsz;
}
/*
* Get the alignment of the given Type in bits.
*/
int
getbound(const type_t *tp)
alignment_in_bits(const type_t *tp)
{
size_t a;
tspec_t t;
@ -1177,12 +1174,12 @@ declarator_1_struct_union(sym_t *dsym)
dcs->d_offset = 0;
}
if (dsym->s_bitfield) {
align(getbound(tp), tp->t_flen);
align(alignment_in_bits(tp), tp->t_flen);
dsym->s_value.v_quad = (dcs->d_offset / size(t)) * size(t);
tp->t_foffs = dcs->d_offset - (int)dsym->s_value.v_quad;
dcs->d_offset += tp->t_flen;
} else {
align(getbound(tp), 0);
align(alignment_in_bits(tp), 0);
dsym->s_value.v_quad = dcs->d_offset;
dcs->d_offset += sz;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: externs1.h,v 1.71 2021/02/21 15:02:16 rillig Exp $ */
/* $NetBSD: externs1.h,v 1.72 2021/02/28 00:23:55 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@ -154,7 +154,7 @@ extern void setasm(void);
extern void clrtyp(void);
extern void deftyp(void);
extern int length(const type_t *, const char *);
extern int getbound(const type_t *);
extern int alignment_in_bits(const type_t *);
extern sym_t *lnklst(sym_t *, sym_t *);
extern void check_type(sym_t *);
extern sym_t *declarator_1_struct_union(sym_t *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tree.c,v 1.219 2021/02/27 15:26:30 rillig Exp $ */
/* $NetBSD: tree.c,v 1.220 2021/02/28 00:23:55 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.219 2021/02/27 15:26:30 rillig Exp $");
__RCSID("$NetBSD: tree.c,v 1.220 2021/02/28 00:23:55 rillig Exp $");
#endif
#include <float.h>
@ -2243,7 +2243,8 @@ check_pointer_conversion(op_t op, tnode_t *tn, type_t *tp)
return;
}
if (getbound(tp->t_subt) > getbound(tn->tn_type->t_subt)) {
if (alignment_in_bits(tp->t_subt) >
alignment_in_bits(tn->tn_type->t_subt)) {
if (hflag)
/* possible pointer alignment problem */
warning(135);
@ -3420,7 +3421,7 @@ build_alignof(type_t *tp)
}
return new_integer_constant_node(SIZEOF_TSPEC,
(int64_t)getbound(tp) / CHAR_SIZE);
(int64_t)alignment_in_bits(tp) / CHAR_SIZE);
}
/*