Module Name: src Committed By: rillig Date: Fri Jul 23 16:43:11 UTC 2021
Modified Files: src/usr.bin/xlint/lint1: decl.c lint1.h Log Message: lint: make offset and alignment positive numbers There's no use case for negative alignment or offsets in structures. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.115 -r1.116 src/usr.bin/xlint/lint1/lint1.h 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.207 src/usr.bin/xlint/lint1/decl.c:1.208 --- src/usr.bin/xlint/lint1/decl.c:1.207 Thu Jul 15 23:54:22 2021 +++ src/usr.bin/xlint/lint1/decl.c Fri Jul 23 16:43:11 2021 @@ -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 Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.115 src/usr.bin/xlint/lint1/lint1.h:1.116 --- src/usr.bin/xlint/lint1/lint1.h:1.115 Thu Jul 15 18:13:25 2021 +++ src/usr.bin/xlint/lint1/lint1.h Fri Jul 23 16:43:11 2021 @@ -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 */