lint: make offset and alignment positive numbers
There's no use case for negative alignment or offsets in structures. No functional change.
This commit is contained in:
parent
203492dc2b
commit
f86314b83c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: decl.c,v 1.207 2021/07/15 23:54:22 rillig Exp $ */
|
||||
/* $NetBSD: decl.c,v 1.208 2021/07/23 16:43:11 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.207 2021/07/15 23:54:22 rillig Exp $");
|
||||
__RCSID("$NetBSD: decl.c,v 1.208 2021/07/23 16:43:11 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -64,7 +64,7 @@ dinfo_t *dcs;
|
|||
|
||||
static type_t *tdeferr(type_t *, tspec_t);
|
||||
static void settdsym(type_t *, sym_t *);
|
||||
static void align(int, int);
|
||||
static void align(u_int, u_int);
|
||||
static sym_t *newtag(sym_t *, scl_t, bool, bool);
|
||||
static bool eqargs(const type_t *, const type_t *, bool *);
|
||||
static bool mnoarg(const type_t *, bool *);
|
||||
|
@ -1154,7 +1154,7 @@ declarator_1_struct_union(sym_t *dsym)
|
|||
type_t *tp;
|
||||
tspec_t t;
|
||||
int sz;
|
||||
int o = 0; /* Appease GCC */
|
||||
u_int o = 0; /* Appease GCC */
|
||||
|
||||
lint_assert(dsym->s_scl == MOS || dsym->s_scl == MOU);
|
||||
|
||||
|
@ -1231,9 +1231,9 @@ declarator_1_struct_union(sym_t *dsym)
|
|||
* al contains the required alignment, len the length of a bit-field.
|
||||
*/
|
||||
static void
|
||||
align(int al, int len)
|
||||
align(u_int al, u_int len)
|
||||
{
|
||||
int no;
|
||||
u_int no;
|
||||
|
||||
/*
|
||||
* The alignment of the current element becomes the alignment of
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lint1.h,v 1.115 2021/07/15 18:13:25 rillig Exp $ */
|
||||
/* $NetBSD: lint1.h,v 1.116 2021/07/23 16:43:11 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
|
||||
|
@ -360,8 +360,8 @@ typedef struct dinfo {
|
|||
type_t *d_type; /* after end_type() pointer to the type used
|
||||
for all declarators */
|
||||
sym_t *d_redeclared_symbol;
|
||||
int d_offset; /* offset of next structure member */
|
||||
int d_sou_align_in_bits; /* alignment required for current
|
||||
u_int d_offset; /* offset of next structure member */
|
||||
u_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 */
|
||||
|
|
Loading…
Reference in New Issue