Module Name: src Committed By: rillig Date: Sun Jul 2 17:41:30 UTC 2023
Modified Files: src/usr.bin/xlint/lint1: debug.c decl.c lint1.h Log Message: lint: use unsigned int for struct alignment This gets rid of 'unsigned short', which saved a few bytes of memory but was inconvenient to deal with. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/debug.c cvs rdiff -u -r1.335 -r1.336 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.175 -r1.176 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/debug.c diff -u src/usr.bin/xlint/lint1/debug.c:1.43 src/usr.bin/xlint/lint1/debug.c:1.44 --- src/usr.bin/xlint/lint1/debug.c:1.43 Sun Jul 2 10:20:45 2023 +++ src/usr.bin/xlint/lint1/debug.c Sun Jul 2 17:41:30 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.c,v 1.43 2023/07/02 10:20:45 rillig Exp $ */ +/* $NetBSD: debug.c,v 1.44 2023/07/02 17:41:30 rillig Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: debug.c,v 1.43 2023/07/02 10:20:45 rillig Exp $"); +__RCSID("$NetBSD: debug.c,v 1.44 2023/07/02 17:41:30 rillig Exp $"); #endif #include <stdlib.h> @@ -126,8 +126,7 @@ debug_type_details(const type_t *tp) if (is_struct_or_union(tp->t_tspec)) { debug_indent_inc(); debug_step("size %u bits, align %u bits, %s", - tp->t_sou->sou_size_in_bits, - (unsigned int)tp->t_sou->sou_align_in_bits, + tp->t_sou->sou_size_in_bits, tp->t_sou->sou_align_in_bits, tp->t_sou->sou_incomplete ? "incomplete" : "complete"); for (const sym_t *mem = tp->t_sou->sou_first_member; @@ -418,7 +417,7 @@ debug_decl_level(const decl_level *dl) if (dl->d_offset_in_bits != 0) debug_printf(" offset=%u", dl->d_offset_in_bits); if (dl->d_sou_align_in_bits != 0) - debug_printf(" align=%u", (unsigned)dl->d_sou_align_in_bits); + debug_printf(" align=%u", dl->d_sou_align_in_bits); debug_word(dl->d_const, "const"); debug_word(dl->d_volatile, "volatile"); Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.335 src/usr.bin/xlint/lint1/decl.c:1.336 --- src/usr.bin/xlint/lint1/decl.c:1.335 Sun Jul 2 10:20:45 2023 +++ src/usr.bin/xlint/lint1/decl.c Sun Jul 2 17:41:30 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.335 2023/07/02 10:20:45 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.336 2023/07/02 17:41:30 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: decl.c,v 1.335 2023/07/02 10:20:45 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.336 2023/07/02 17:41:30 rillig Exp $"); #endif #include <sys/param.h> @@ -1731,7 +1731,7 @@ complete_struct_or_union(sym_t *first_me if (tp == NULL) /* in case of syntax errors */ return gettyp(INT); - dcs_align((u_int)dcs->d_sou_align_in_bits, 0); + dcs_align(dcs->d_sou_align_in_bits, 0); struct_or_union *sp = tp->t_sou; sp->sou_align_in_bits = dcs->d_sou_align_in_bits; Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.175 src/usr.bin/xlint/lint1/lint1.h:1.176 --- src/usr.bin/xlint/lint1/lint1.h:1.175 Sun Jul 2 08:16:19 2023 +++ src/usr.bin/xlint/lint1/lint1.h Sun Jul 2 17:41:30 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.175 2023/07/02 08:16:19 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.176 2023/07/02 17:41:30 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -121,7 +121,7 @@ typedef struct { */ typedef struct { unsigned int sou_size_in_bits; - unsigned short sou_align_in_bits; + unsigned int sou_align_in_bits; bool sou_incomplete:1; struct sym *sou_first_member; struct sym *sou_tag; @@ -354,7 +354,7 @@ typedef struct decl_level { * used for all declarators */ sym_t *d_redeclared_symbol; unsigned int d_offset_in_bits; /* offset of next structure member */ - unsigned short d_sou_align_in_bits; /* alignment required for current + unsigned int d_sou_align_in_bits; /* alignment required for current * structure */ bool d_const:1; /* const in declaration specifiers */ bool d_volatile:1; /* volatile in declaration specifiers */