Module Name:    src
Committed By:   rillig
Date:           Mon Jul  5 19:48:32 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y decl.c lint1.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.110 -r1.111 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/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.249 src/usr.bin/xlint/lint1/cgram.y:1.250
--- src/usr.bin/xlint/lint1/cgram.y:1.249	Sat Jul  3 21:18:40 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jul  5 19:48:32 2021
@@ -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 @@ struct:
 		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;
 	  }
 	;

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.193 src/usr.bin/xlint/lint1/decl.c:1.194
--- src/usr.bin/xlint/lint1/decl.c:1.193	Sun Jul  4 13:31:10 2021
+++ src/usr.bin/xlint/lint1/decl.c	Mon Jul  5 19:48:32 2021
@@ -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 @@ align(int al, int len)
 	 * 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 @@ complete_tag_struct_or_union(type_t *tp,
 	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);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.110 src/usr.bin/xlint/lint1/lint1.h:1.111
--- src/usr.bin/xlint/lint1/lint1.h:1.110	Sun Jul  4 09:13:59 2021
+++ src/usr.bin/xlint/lint1/lint1.h	Mon Jul  5 19:48:32 2021
@@ -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 @@ typedef	struct dinfo {
 				   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 */

Reply via email to