Module Name:    src
Committed By:   rillig
Date:           Sun Jul  2 08:16:19 UTC 2023

Modified Files:
        src/usr.bin/xlint/lint1: debug.c decl.c lint1.h tree.c

Log Message:
lint: clean up variable names


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.332 -r1.333 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.542 -r1.543 src/usr.bin/xlint/lint1/tree.c

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.41 src/usr.bin/xlint/lint1/debug.c:1.42
--- src/usr.bin/xlint/lint1/debug.c:1.41	Sat Jul  1 09:21:31 2023
+++ src/usr.bin/xlint/lint1/debug.c	Sun Jul  2 08:16:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.41 2023/07/01 09:21:31 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.42 2023/07/02 08:16:19 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.41 2023/07/01 09:21:31 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.42 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -368,14 +368,13 @@ debug_sym(const char *prefix, const sym_
 		    sym->u.s_bool_constant ? "true" : "false");
 
 	if (is_member(sym)) {
-		struct_or_union *sou_type = sym->u.s_member.sm_sou_type;
-		lint_assert(sou_type != NULL);
-		const char *tag = sou_type->sou_tag->s_name;
-		const sym_t *def = sou_type->sou_first_typedef;
+		struct_or_union *sou = sym->u.s_member.sm_containing_type;
+		const char *tag = sou->sou_tag->s_name;
+		const sym_t *def = sou->sou_first_typedef;
 		if (tag == unnamed && def != NULL)
 			debug_printf(" sou='typedef %s'", def->s_name);
 		else
-			debug_printf(" sou=%s", tag);
+			debug_printf(" sou='%s'", tag);
 	}
 
 	if (sym->s_keyword != NULL) {
@@ -383,7 +382,7 @@ debug_sym(const char *prefix, const sym_
 		if (t == T_TYPE || t == T_STRUCT_OR_UNION)
 			debug_printf(" %s",
 			    tspec_name(sym->u.s_keyword.sk_tspec));
-		else if (t == T_QUAL)
+		if (t == T_QUAL)
 			debug_printf(" %s",
 			    tqual_name(sym->u.s_keyword.sk_qualifier));
 	}

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.332 src/usr.bin/xlint/lint1/decl.c:1.333
--- src/usr.bin/xlint/lint1/decl.c:1.332	Sat Jul  1 10:04:27 2023
+++ src/usr.bin/xlint/lint1/decl.c	Sun Jul  2 08:16:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.332 2023/07/01 10:04:27 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.333 2023/07/02 08:16:19 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.332 2023/07/01 10:04:27 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.333 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1069,8 +1069,8 @@ declare_member(sym_t *dsym)
 	if (dcs->d_redeclared_symbol != NULL) {
 		lint_assert(is_member(dcs->d_redeclared_symbol));
 
-		if (dsym->u.s_member.sm_sou_type ==
-		    dcs->d_redeclared_symbol->u.s_member.sm_sou_type) {
+		if (dsym->u.s_member.sm_containing_type ==
+		    dcs->d_redeclared_symbol->u.s_member.sm_containing_type) {
 			/* duplicate member name '%s' */
 			error(33, dsym->s_name);
 			rmsym(dcs->d_redeclared_symbol);
@@ -1465,8 +1465,7 @@ declarator_name(sym_t *sym)
 	switch (dcs->d_kind) {
 	case DLK_STRUCT:
 	case DLK_UNION:
-		/* Set parent */
-		sym->u.s_member.sm_sou_type = dcs->d_tag_type->t_sou;
+		sym->u.s_member.sm_containing_type = dcs->d_tag_type->t_sou;
 		sym->s_def = DEF;
 		sc = dcs->d_kind == DLK_STRUCT ? STRUCT_MEMBER : UNION_MEMBER;
 		break;

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.174 src/usr.bin/xlint/lint1/lint1.h:1.175
--- src/usr.bin/xlint/lint1/lint1.h:1.174	Sat Jul  1 09:59:51 2023
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Jul  2 08:16:19 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.174 2023/07/01 09:59:51 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.175 2023/07/02 08:16:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -248,8 +248,7 @@ typedef	struct sym {
 		bool s_bool_constant;
 		int s_enum_constant;	/* XXX: should be TARG_INT */
 		struct {
-			/* XXX: what is the difference to s_type->t_sou? */
-			struct_or_union	*sm_sou_type;
+			struct_or_union	*sm_containing_type;
 			unsigned int sm_offset_in_bits;
 		} s_member;
 		struct {

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.542 src/usr.bin/xlint/lint1/tree.c:1.543
--- src/usr.bin/xlint/lint1/tree.c:1.542	Sat Jul  1 10:04:27 2023
+++ src/usr.bin/xlint/lint1/tree.c	Sun Jul  2 08:16:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.543 2023/07/02 08:16:19 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.542 2023/07/01 10:04:27 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.543 2023/07/02 08:16:19 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1925,7 +1925,7 @@ struct_or_union_member(tnode_t *tn, op_t
 		sou->sou_tag = expr_zero_alloc(sizeof(*sou->sou_tag));
 		sou->sou_tag->s_name = unnamed;
 
-		msym->u.s_member.sm_sou_type = sou;
+		msym->u.s_member.sm_containing_type = sou;
 		/*
 		 * The member sm_offset_in_bits is not needed here since this
 		 * symbol can only be used for error reporting.
@@ -1940,16 +1940,16 @@ struct_or_union_member(tnode_t *tn, op_t
 	if (op == ARROW && tn->tn_type->t_tspec == PTR
 	    && is_struct_or_union(tn->tn_type->t_subt->t_tspec))
 		tp = tn->tn_type->t_subt;
-	struct_or_union *str = tp != NULL ? tp->t_sou : NULL;
+	struct_or_union *sou = tp != NULL ? tp->t_sou : NULL;
 
 	/*
 	 * If this struct/union has a member with the name of msym, return it.
 	 */
-	if (str != NULL) {
+	if (sou != NULL) {
 		for (sym_t *sym = msym;
 		     sym != NULL; sym = sym->s_symtab_next) {
 			if (is_member(sym) &&
-			    sym->u.s_member.sm_sou_type == str &&
+			    sym->u.s_member.sm_containing_type == sou &&
 			    strcmp(sym->s_name, msym->s_name) == 0)
 				return sym;
 		}
@@ -1967,7 +1967,7 @@ struct_or_union_member(tnode_t *tn, op_t
 	 * Now handle the case in which the left operand refers really
 	 * to a struct/union, but the right operand is not member of it.
 	 */
-	if (str != NULL) {
+	if (sou != NULL) {
 		if (eq && !allow_c90) {
 			/* illegal use of member '%s' */
 			warning(102, msym->s_name);

Reply via email to