Module Name:    src
Committed By:   rillig
Date:           Sun Feb 27 10:44:45 UTC 2022

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

Log Message:
lint: unabbreviate some fields in sym_t

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.127 -r1.128 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/xlint/lint1/lex.c
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.406 -r1.407 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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.247 src/usr.bin/xlint/lint1/decl.c:1.248
--- src/usr.bin/xlint/lint1/decl.c:1.247	Sun Feb 27 10:31:58 2022
+++ src/usr.bin/xlint/lint1/decl.c	Sun Feb 27 10:44:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.247 2022/02/27 10:31:58 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 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.247 2022/02/27 10:31:58 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.248 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1440,7 +1440,7 @@ new_style_function(sym_t *decl, sym_t *a
 	 * Declarations of structs/unions/enums in param lists are legal,
 	 * but senseless.
 	 */
-	for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+	for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_level_next) {
 		sc = sym->s_scl;
 		if (sc == STRUCT_TAG || sc == UNION_TAG || sc == ENUM_TAG) {
 			/* dubious tag declaration: %s %s */
@@ -2776,7 +2776,7 @@ declare_external_in_block(sym_t *dsym)
 	/* look for a symbol with the same name */
 	esym = dcs->d_redeclared_symbol;
 	while (esym != NULL && esym->s_block_level != 0) {
-		while ((esym = esym->s_link) != NULL) {
+		while ((esym = esym->s_symtab_next) != NULL) {
 			if (esym->s_kind != FVFT)
 				continue;
 			if (strcmp(dsym->s_name, esym->s_name) == 0)
@@ -2984,7 +2984,7 @@ mark_as_used(sym_t *sym, bool fcall, boo
 
 /*
  * Prints warnings for a list of variables and labels (concatenated
- * with s_dlnxt) if these are not used or only set.
+ * with s_level_next) if these are not used or only set.
  */
 void
 check_usage(dinfo_t *di)
@@ -2997,7 +2997,7 @@ check_usage(dinfo_t *di)
 	lwarn = LWARN_ALL;
 
 	debug_step("begin lwarn %d", lwarn);
-	for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_dlnxt)
+	for (sym = di->d_dlsyms; sym != NULL; sym = sym->s_level_next)
 		check_usage_sym(di->d_asm, sym);
 	lwarn = mklwarn;
 	debug_step("end lwarn %d", lwarn);
@@ -3170,7 +3170,7 @@ check_global_symbols(void)
 	if (block_level != 0 || dcs->d_next != NULL)
 		norecover();
 
-	for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_dlnxt) {
+	for (sym = dcs->d_dlsyms; sym != NULL; sym = sym->s_level_next) {
 		if (sym->s_block_level == -1)
 			continue;
 		if (sym->s_kind == FVFT) {

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.127 src/usr.bin/xlint/lint1/func.c:1.128
--- src/usr.bin/xlint/lint1/func.c:1.127	Sun Feb 27 08:31:26 2022
+++ src/usr.bin/xlint/lint1/func.c	Sun Feb 27 10:44:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.127 2022/02/27 08:31:26 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.128 2022/02/27 10:44:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: func.c,v 1.127 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.128 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -235,7 +235,8 @@ funcdef(sym_t *fsym)
 	 * Put all symbols declared in the argument list back to the
 	 * symbol table.
 	 */
-	for (sym = dcs->d_func_proto_syms; sym != NULL; sym = sym->s_dlnxt) {
+	for (sym = dcs->d_func_proto_syms; sym != NULL;
+	    sym = sym->s_level_next) {
 		if (sym->s_block_level != -1) {
 			lint_assert(sym->s_block_level == 1);
 			inssym(1, sym);

Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.101 src/usr.bin/xlint/lint1/lex.c:1.102
--- src/usr.bin/xlint/lint1/lex.c:1.101	Sun Feb 27 08:31:26 2022
+++ src/usr.bin/xlint/lint1/lex.c	Sun Feb 27 10:44:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.101 2022/02/27 08:31:26 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.102 2022/02/27 10:44:45 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: lex.c,v 1.101 2022/02/27 08:31:26 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.102 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -266,9 +266,9 @@ symtab_add(sym_t *sym)
 	size_t h;
 
 	h = hash(sym->s_name);
-	if ((sym->s_link = symtab[h]) != NULL)
-		symtab[h]->s_rlink = &sym->s_link;
-	sym->s_rlink = &symtab[h];
+	if ((sym->s_symtab_next = symtab[h]) != NULL)
+		symtab[h]->s_symtab_ref = &sym->s_symtab_next;
+	sym->s_symtab_ref = &symtab[h];
 	symtab[h] = sym;
 }
 
@@ -276,9 +276,9 @@ static void
 symtab_remove(sym_t *sym)
 {
 
-	if ((*sym->s_rlink = sym->s_link) != NULL)
-		sym->s_link->s_rlink = sym->s_rlink;
-	sym->s_link = NULL;
+	if ((*sym->s_symtab_ref = sym->s_symtab_next) != NULL)
+		sym->s_symtab_next->s_symtab_ref = sym->s_symtab_ref;
+	sym->s_symtab_next = NULL;
 }
 
 
@@ -426,7 +426,7 @@ search(sbuf_t *sb)
 	const struct keyword *kw;
 
 	h = hash(sb->sb_name);
-	for (sym = symtab[h]; sym != NULL; sym = sym->s_link) {
+	for (sym = symtab[h]; sym != NULL; sym = sym->s_symtab_next) {
 		if (strcmp(sym->s_name, sb->sb_name) != 0)
 			continue;
 		kw = sym->s_keyword;
@@ -1377,7 +1377,7 @@ getsym(sbuf_t *sb)
 	symtab_add(sym);
 
 	*di->d_ldlsym = sym;
-	di->d_ldlsym = &sym->s_dlnxt;
+	di->d_ldlsym = &sym->s_level_next;
 
 	free(sb);
 	return sym;
@@ -1412,7 +1412,7 @@ mktempsym(type_t *t)
 	symtab_add(sym);
 
 	*dcs->d_ldlsym = sym;
-	dcs->d_ldlsym = &sym->s_dlnxt;
+	dcs->d_ldlsym = &sym->s_level_next;
 
 	return sym;
 }
@@ -1439,13 +1439,13 @@ rmsyms(sym_t *syms)
 {
 	sym_t	*sym;
 
-	for (sym = syms; sym != NULL; sym = sym->s_dlnxt) {
+	for (sym = syms; sym != NULL; sym = sym->s_level_next) {
 		if (sym->s_block_level != -1) {
 			debug_step("rmsyms '%s' %s '%s'",
 			    sym->s_name, symt_name(sym->s_kind),
 			    type_name(sym->s_type));
 			symtab_remove(sym);
-			sym->s_rlink = NULL;
+			sym->s_symtab_ref = NULL;
 		}
 	}
 }
@@ -1461,8 +1461,8 @@ inssym(int bl, sym_t *sym)
 	    sym->s_name, symt_name(sym->s_kind), type_name(sym->s_type));
 	symtab_add(sym);
 	sym->s_block_level = bl;
-	lint_assert(sym->s_link == NULL ||
-		    sym->s_block_level >= sym->s_link->s_block_level);
+	lint_assert(sym->s_symtab_next == NULL ||
+		    sym->s_block_level >= sym->s_symtab_next->s_block_level);
 }
 
 /*
@@ -1480,7 +1480,7 @@ cleanup(void)
 
 	for (i = 0; i < HSHSIZ1; i++) {
 		for (sym = symtab[i]; sym != NULL; sym = nsym) {
-			nsym = sym->s_link;
+			nsym = sym->s_symtab_next;
 			if (sym->s_block_level >= 1)
 				symtab_remove(sym);
 		}
@@ -1510,7 +1510,7 @@ pushdown(const sym_t *sym)
 	symtab_add(nsym);
 
 	*dcs->d_ldlsym = nsym;
-	dcs->d_ldlsym = &nsym->s_dlnxt;
+	dcs->d_ldlsym = &nsym->s_level_next;
 
 	return nsym;
 }

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.138 src/usr.bin/xlint/lint1/lint1.h:1.139
--- src/usr.bin/xlint/lint1/lint1.h:1.138	Sun Feb 27 07:50:09 2022
+++ src/usr.bin/xlint/lint1/lint1.h	Sun Feb 27 10:44:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.138 2022/02/27 07:50:09 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.139 2022/02/27 10:44:45 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -273,11 +273,13 @@ typedef	struct sym {
 		struct	sym *_s_args; /* arguments in old style function
 					 definitions */
 	} u;
-	struct	sym *s_link;	/* next symbol with same hash value */
-	struct	sym **s_rlink;	/* pointer to s_link of prev. symbol */
+	struct	sym *s_symtab_next;	/* next symbol with same hash value */
+	struct	sym **s_symtab_ref;	/* pointer to s_symtab_next of the
+					 * previous symbol */
 	struct	sym *s_next;	/* next struct/union member, enumerator,
 				   argument */
-	struct	sym *s_dlnxt;	/* next symbol declared on same level */
+	struct	sym *s_level_next;	/* next symbol declared on the same
+					 * level */
 } sym_t;
 
 #define	s_styp	u._s_st
@@ -387,8 +389,8 @@ typedef	struct dinfo {
 	sym_t	*d_func_args;	/* list of arguments during function def. */
 	pos_t	d_func_def_pos;	/* position of function definition */
 	sym_t	*d_dlsyms;	/* first symbol declared at this level */
-	sym_t	**d_ldlsym;	/* points to s_dlnxt in last symbol decl.
-				   at this level */
+	sym_t	**d_ldlsym;	/* points to s_level_next in the last symbol
+				   declaration at this level */
 	sym_t	*d_func_proto_syms; /* symbols defined in prototype */
 	struct	dinfo *d_next;	/* next level */
 } dinfo_t;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.406 src/usr.bin/xlint/lint1/tree.c:1.407
--- src/usr.bin/xlint/lint1/tree.c:1.406	Sun Feb 27 10:31:58 2022
+++ src/usr.bin/xlint/lint1/tree.c	Sun Feb 27 10:44:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.406 2022/02/27 10:31:58 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.407 2022/02/27 10:44:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.406 2022/02/27 10:31:58 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.407 2022/02/27 10:44:45 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -379,7 +379,7 @@ struct_or_union_member(tnode_t *tn, op_t
 	 * If this struct/union has a member with the name of msym, return it.
 	 */
 	if (str != NULL) {
-		for (sym = msym; sym != NULL; sym = sym->s_link) {
+		for (sym = msym; sym != NULL; sym = sym->s_symtab_next) {
 			if (sym->s_scl != MOS && sym->s_scl != MOU)
 				continue;
 			if (sym->s_styp != str)
@@ -395,12 +395,13 @@ struct_or_union_member(tnode_t *tn, op_t
 	 * name and different types and/or offsets.
 	 */
 	eq = true;
-	for (csym = msym; csym != NULL; csym = csym->s_link) {
+	for (csym = msym; csym != NULL; csym = csym->s_symtab_next) {
 		if (csym->s_scl != MOS && csym->s_scl != MOU)
 			continue;
 		if (strcmp(msym->s_name, csym->s_name) != 0)
 			continue;
-		for (sym = csym->s_link; sym != NULL; sym = sym->s_link) {
+		for (sym = csym->s_symtab_next; sym != NULL;
+		    sym = sym->s_symtab_next) {
 			bool w;
 
 			if (sym->s_scl != MOS && sym->s_scl != MOU)

Reply via email to