Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: make offset and alignment positive...



details:   https://anonhg.NetBSD.org/src/rev/f4458cdaea1e
branches:  trunk
changeset: 984785:f4458cdaea1e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 23 16:43:11 2021 +0000

description:
lint: make offset and alignment positive numbers

There's no use case for negative alignment or offsets in structures.

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c  |  12 ++++++------
 usr.bin/xlint/lint1/lint1.h |   6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (68 lines):

diff -r 8933e208a145 -r f4458cdaea1e usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Fri Jul 23 15:36:56 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Fri Jul 23 16:43:11 2021 +0000
@@ -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 @@
 
 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 @@
        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 @@
  * 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
diff -r 8933e208a145 -r f4458cdaea1e usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Fri Jul 23 15:36:56 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Fri Jul 23 16:43:11 2021 +0000
@@ -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 @@
        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 */



Home | Main Index | Thread Index | Old Index