Module Name:    src
Committed By:   rillig
Date:           Wed Dec 30 11:14:03 UTC 2020

Modified Files:
        src/usr.bin/xlint/lint1: decl.c emit1.c func.c lint1.h scan.l

Log Message:
lint: un-abbreviate s_dpos, s_spos and s_upos


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/xlint/lint1/lint1.h
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/xlint/lint1/scan.l

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.83 src/usr.bin/xlint/lint1/decl.c:1.84
--- src/usr.bin/xlint/lint1/decl.c:1.83	Wed Dec 30 11:04:48 2020
+++ src/usr.bin/xlint/lint1/decl.c	Wed Dec 30 11:14:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.83 2020/12/30 11:04:48 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 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.83 2020/12/30 11:04:48 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.84 2020/12/30 11:14:03 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1663,7 +1663,7 @@ mktag(sym_t *tag, tspec_t kind, int decl
 	} else {
 		tag = getblk(sizeof (sym_t));
 		tag->s_name = unnamed;
-		UNIQUE_CURR_POS(tag->s_dpos);
+		UNIQUE_CURR_POS(tag->s_def_pos);
 		tag->s_kind = FTAG;
 		tag->s_scl = scl;
 		tag->s_blklev = -1;
@@ -1918,7 +1918,7 @@ decl1ext(sym_t *dsym, int initflg)
 		 * written as a function definition to the output file.
 		 */
 		rval = dsym->s_type->t_subt->t_tspec != VOID;
-		outfdef(dsym, &dsym->s_dpos, rval, 0, NULL);
+		outfdef(dsym, &dsym->s_def_pos, rval, 0, NULL);
 	} else {
 		outsym(dsym, dsym->s_scl, dsym->s_def);
 	}
@@ -1951,7 +1951,7 @@ decl1ext(sym_t *dsym, int initflg)
 			if (rdsym->s_osdef && !dsym->s_type->t_proto) {
 				dsym->s_osdef = rdsym->s_osdef;
 				dsym->s_args = rdsym->s_args;
-				STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+				STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos);
 			}
 
 			/*
@@ -1961,9 +1961,9 @@ decl1ext(sym_t *dsym, int initflg)
 			 * was defined and the new is not.
 			 */
 			if (rdsym->s_type->t_proto && !dsym->s_type->t_proto) {
-				STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+				STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos);
 			} else if (rdsym->s_def == DEF && dsym->s_def != DEF) {
-				STRUCT_ASSIGN(dsym->s_dpos, rdsym->s_dpos);
+				STRUCT_ASSIGN(dsym->s_def_pos, rdsym->s_def_pos);
 			}
 
 			/*
@@ -2003,8 +2003,8 @@ void
 copy_usage_info(sym_t *sym, sym_t *rdsym)
 {
 
-	sym->s_spos = rdsym->s_spos;
-	sym->s_upos = rdsym->s_upos;
+	sym->s_set_pos = rdsym->s_set_pos;
+	sym->s_use_pos = rdsym->s_use_pos;
 	sym->s_set = rdsym->s_set;
 	sym->s_used = rdsym->s_used;
 }
@@ -2875,7 +2875,7 @@ mark_as_set(sym_t *sym)
 
 	if (!sym->s_set) {
 		sym->s_set = 1;
-		UNIQUE_CURR_POS(sym->s_spos);
+		UNIQUE_CURR_POS(sym->s_set_pos);
 	}
 }
 
@@ -2888,7 +2888,7 @@ mark_as_used(sym_t *sym, int fcall, int 
 
 	if (!sym->s_used) {
 		sym->s_used = 1;
-		UNIQUE_CURR_POS(sym->s_upos);
+		UNIQUE_CURR_POS(sym->s_use_pos);
 	}
 	/*
 	 * for function calls another record is written
@@ -2968,7 +2968,7 @@ check_argument_usage(int novar, sym_t *a
 		return;
 
 	if (!arg->s_used && vflag) {
-		STRUCT_ASSIGN(curr_pos, arg->s_dpos);
+		STRUCT_ASSIGN(curr_pos, arg->s_def_pos);
 		/* argument %s unused in function %s */
 		warning(231, arg->s_name, funcsym->s_name);
 	}
@@ -3001,17 +3001,17 @@ check_variable_usage(int novar, sym_t *s
 
 	if (sc == EXTERN) {
 		if (!sym->s_used && !sym->s_set) {
-			STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+			STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 			/* %s unused in function %s */
 			warning(192, sym->s_name, funcsym->s_name);
 		}
 	} else {
 		if (sym->s_set && !sym->s_used) {
-			STRUCT_ASSIGN(curr_pos, sym->s_spos);
+			STRUCT_ASSIGN(curr_pos, sym->s_set_pos);
 			/* %s set but not used in function %s */
 			warning(191, sym->s_name, funcsym->s_name);
 		} else if (!sym->s_used) {
-			STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+			STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 			/* %s unused in function %s */
 			warning(192, sym->s_name, funcsym->s_name);
 		}
@@ -3031,11 +3031,11 @@ check_variable_usage(int novar, sym_t *s
 		if ((xsym = sym->s_ext_sym) != NULL) {
 			if (sym->s_used && !xsym->s_used) {
 				xsym->s_used = 1;
-				STRUCT_ASSIGN(xsym->s_upos, sym->s_upos);
+				STRUCT_ASSIGN(xsym->s_use_pos, sym->s_use_pos);
 			}
 			if (sym->s_set && !xsym->s_set) {
 				xsym->s_set = 1;
-				STRUCT_ASSIGN(xsym->s_spos, sym->s_spos);
+				STRUCT_ASSIGN(xsym->s_set_pos, sym->s_set_pos);
 			}
 		}
 	}
@@ -3049,11 +3049,11 @@ check_label_usage(sym_t *lab)
 		LERROR("check_label_usage()");
 
 	if (lab->s_set && !lab->s_used) {
-		STRUCT_ASSIGN(curr_pos, lab->s_spos);
+		STRUCT_ASSIGN(curr_pos, lab->s_set_pos);
 		/* label %s unused in function %s */
 		warning(192, lab->s_name, funcsym->s_name);
 	} else if (!lab->s_set) {
-		STRUCT_ASSIGN(curr_pos, lab->s_upos);
+		STRUCT_ASSIGN(curr_pos, lab->s_use_pos);
 		/* undefined label %s */
 		warning(23, lab->s_name);
 	}
@@ -3070,7 +3070,7 @@ check_tag_usage(sym_t *sym)
 	if (!zflag || dcs->d_ctx != EXTERN)
 		return;
 
-	STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+	STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 	switch (sym->s_type->t_tspec) {
 	case STRUCT:
 		/* struct %s never defined */
@@ -3139,13 +3139,13 @@ check_global_variable(sym_t *sym)
 	if (sym->s_scl == STATIC) {
 		if (sym->s_type->t_tspec == FUNC) {
 			if (sym->s_used && sym->s_def != DEF) {
-				STRUCT_ASSIGN(curr_pos, sym->s_upos);
+				STRUCT_ASSIGN(curr_pos, sym->s_use_pos);
 				/* static func. called but not def.. */
 				error(225, sym->s_name);
 			}
 		}
 		if (!sym->s_used) {
-			STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+			STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 			if (sym->s_type->t_tspec == FUNC) {
 				if (sym->s_def == DEF) {
 					if (!sym->s_inline)
@@ -3164,7 +3164,7 @@ check_global_variable(sym_t *sym)
 			}
 		}
 		if (!tflag && sym->s_def == TDEF && sym->s_type->t_const) {
-			STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+			STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 			/* const object %s should have initializer */
 			warning(227, sym->s_name);
 		}
@@ -3182,7 +3182,7 @@ check_global_variable_size(sym_t *sym)
 			 * after a function declaration
 			 */
 			return;
-		STRUCT_ASSIGN(curr_pos, sym->s_dpos);
+		STRUCT_ASSIGN(curr_pos, sym->s_def_pos);
 		if (length(sym->s_type, sym->s_name) == 0 &&
 		    sym->s_type->t_tspec == ARRAY && sym->s_type->t_dim == 0) {
 			/* empty array declaration: %s */
@@ -3207,7 +3207,7 @@ print_previous_declaration(int msg, sym_
 		return;
 
 	STRUCT_ASSIGN(cpos, curr_pos);
-	STRUCT_ASSIGN(curr_pos, psym->s_dpos);
+	STRUCT_ASSIGN(curr_pos, psym->s_def_pos);
 	if (msg != -1) {
 		message(msg, psym->s_name);
 	} else if (psym->s_def == DEF || psym->s_def == TDEF) {

Index: src/usr.bin/xlint/lint1/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.28 src/usr.bin/xlint/lint1/emit1.c:1.29
--- src/usr.bin/xlint/lint1/emit1.c:1.28	Wed Dec 30 10:56:51 2020
+++ src/usr.bin/xlint/lint1/emit1.c	Wed Dec 30 11:14:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.28 2020/12/30 10:56:51 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.29 2020/12/30 11:14:03 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: emit1.c,v 1.28 2020/12/30 10:56:51 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.29 2020/12/30 11:14:03 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -210,11 +210,11 @@ outtt(sym_t *tag, sym_t *tdef)
 		outname(tdef->s_name);
 	} else {
 		outint(3);
-		outint(tag->s_dpos.p_line);
+		outint(tag->s_def_pos.p_line);
 		outchar('.');
-		outint(getfnid(tag->s_dpos.p_file));
+		outint(getfnid(tag->s_def_pos.p_file));
 		outchar('.');
-		outint(tag->s_dpos.p_uniq);
+		outint(tag->s_def_pos.p_uniq);
 	}
 }
 
@@ -248,9 +248,9 @@ outsym(sym_t *sym, scl_t sc, def_t def)
 	 */
 	outint(csrc_pos.p_line);
 	outchar('d');
-	outint(getfnid(sym->s_dpos.p_file));
+	outint(getfnid(sym->s_def_pos.p_file));
 	outchar('.');
-	outint(sym->s_dpos.p_line);
+	outint(sym->s_def_pos.p_line);
 
 	/* flags */
 

Index: src/usr.bin/xlint/lint1/func.c
diff -u src/usr.bin/xlint/lint1/func.c:1.34 src/usr.bin/xlint/lint1/func.c:1.35
--- src/usr.bin/xlint/lint1/func.c:1.34	Wed Dec 30 10:49:10 2020
+++ src/usr.bin/xlint/lint1/func.c	Wed Dec 30 11:14:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.34 2020/12/30 10:49:10 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.35 2020/12/30 11:14:03 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.34 2020/12/30 10:49:10 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.35 2020/12/30 11:14:03 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -281,11 +281,11 @@ funcdef(sym_t *fsym)
 	}
 
 	/*
-	 * We must also remember the position. s_dpos is overwritten
+	 * We must also remember the position. s_def_pos is overwritten
 	 * if this is an old style definition and we had already a
 	 * prototype.
 	 */
-	STRUCT_ASSIGN(dcs->d_fdpos, fsym->s_dpos);
+	STRUCT_ASSIGN(dcs->d_fdpos, fsym->s_def_pos);
 
 	if ((rdsym = dcs->d_rdcsym) != NULL) {
 
@@ -311,7 +311,7 @@ funcdef(sym_t *fsym)
 			 * declaration of the prototype.
 			 */
 			if (fsym->s_osdef && rdsym->s_type->t_proto)
-				STRUCT_ASSIGN(fsym->s_dpos, rdsym->s_dpos);
+				STRUCT_ASSIGN(fsym->s_def_pos, rdsym->s_def_pos);
 
 			/* complete the type */
 			complete_type(fsym, rdsym);

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.43 src/usr.bin/xlint/lint1/lint1.h:1.44
--- src/usr.bin/xlint/lint1/lint1.h:1.43	Wed Dec 30 11:04:48 2020
+++ src/usr.bin/xlint/lint1/lint1.h	Wed Dec 30 11:14:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.43 2020/12/30 11:04:48 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.44 2020/12/30 11:14:03 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -218,12 +218,12 @@ typedef enum {
 typedef	struct sym {
 	const	char *s_name;
 	const	char *s_rename;	/* renamed symbol's given name */
-	pos_t	s_dpos;		/* position of last (prototype) definition,
+	pos_t	s_def_pos;	/* position of last (prototype) definition,
 				   prototype declaration, no-prototype-def.,
 				   tentative definition or declaration,
 				   in this order */
-	pos_t	s_spos;		/* position of first initialisation */
-	pos_t	s_upos;		/* position of first use */
+	pos_t	s_set_pos;	/* position of first initialisation */
+	pos_t	s_use_pos;	/* position of first use */
 	symt_t	s_kind;		/* type of symbol */
 	void   *s_keyword;
 	u_int	s_bitfield : 1;

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.103 src/usr.bin/xlint/lint1/scan.l:1.104
--- src/usr.bin/xlint/lint1/scan.l:1.103	Wed Dec 30 11:04:48 2020
+++ src/usr.bin/xlint/lint1/scan.l	Wed Dec 30 11:14:03 2020
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.103 2020/12/30 11:04:48 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.104 2020/12/30 11:14:03 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: scan.l,v 1.103 2020/12/30 11:04:48 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.104 2020/12/30 11:14:03 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1500,7 +1500,7 @@ getsym(sbuf_t *sb)
 		di = dcs;
 	}
 
-	UNIQUE_CURR_POS(sym->s_dpos);
+	UNIQUE_CURR_POS(sym->s_def_pos);
 	if ((sym->s_kind = symtyp) != FLABEL)
 		sym->s_type = gettyp(INT);
 
@@ -1644,7 +1644,7 @@ pushdown(sym_t *sym)
 	if (sym->s_blklev > blklev)
 		LERROR("pushdown()");
 	nsym->s_name = sym->s_name;
-	UNIQUE_CURR_POS(nsym->s_dpos);
+	UNIQUE_CURR_POS(nsym->s_def_pos);
 	nsym->s_kind = sym->s_kind;
 	nsym->s_blklev = blklev;
 

Reply via email to