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: rename dinfo_t.d_stralign to d_sou...



details:   https://anonhg.NetBSD.org/src/rev/b663e2077a5e
branches:  trunk
changeset: 1022130:b663e2077a5e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 05 19:48:32 2021 +0000

description:
lint: rename dinfo_t.d_stralign to d_sou_align_in_bits

When talking about alignment, offset and size of a type, the measurement
unit must be mentioned in the variable name, especially when it differs
from the standard unit of measurement, which is a byte, not a bit.

No functional change.

diffstat:

 usr.bin/xlint/lint1/cgram.y |   6 +++---
 usr.bin/xlint/lint1/decl.c  |  12 ++++++------
 usr.bin/xlint/lint1/lint1.h |   5 +++--
 3 files changed, 12 insertions(+), 11 deletions(-)

diffs (88 lines):

diff -r e358ac5ac618 -r b663e2077a5e usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Mon Jul 05 19:43:29 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Mon Jul 05 19:48:32 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.249 2021/07/03 21:18:40 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.250 2021/07/05 19:48:32 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -759,7 +759,7 @@
                symtyp = FTAG;
                begin_declaration_level($1 == STRUCT ? MOS : MOU);
                dcs->d_offset = 0;
-               dcs->d_stralign = CHAR_SIZE;
+               dcs->d_sou_align_in_bits = CHAR_SIZE;
                $$ = $1;
          }
        ;
diff -r e358ac5ac618 -r b663e2077a5e usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon Jul 05 19:43:29 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon Jul 05 19:48:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.193 2021/07/04 13:31:10 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 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.193 2021/07/04 13:31:10 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1255,8 +1255,8 @@
         * the struct/union if it is larger than the current alignment
         * of the struct/union.
         */
-       if (al > dcs->d_stralign)
-               dcs->d_stralign = al;
+       if (al > dcs->d_sou_align_in_bits)
+               dcs->d_sou_align_in_bits = al;
 
        no = (dcs->d_offset + (al - 1)) & ~(al - 1);
        if (len == 0 || dcs->d_offset + len > no)
@@ -1816,9 +1816,9 @@
        setcomplete(tp, true);
 
        t = tp->t_tspec;
-       align(dcs->d_stralign, 0);
+       align(dcs->d_sou_align_in_bits, 0);
        sp = tp->t_str;
-       sp->sou_align_in_bits = dcs->d_stralign;
+       sp->sou_align_in_bits = dcs->d_sou_align_in_bits;
        sp->sou_first_member = fmem;
        if (tp->t_packed)
                setpackedsize(tp);
diff -r e358ac5ac618 -r b663e2077a5e usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Mon Jul 05 19:43:29 2021 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Mon Jul 05 19:48:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.110 2021/07/04 09:13:59 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.111 2021/07/05 19:48:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -361,7 +361,8 @@
                                   for all declarators */
        sym_t   *d_redeclared_symbol;
        int     d_offset;       /* offset of next structure member */
-       int     d_stralign;     /* alignment required for current structure */
+       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 */
        bool    d_volatile : 1; /* volatile in declaration specifiers */



Home | Main Index | Thread Index | Old Index