Module Name:    src
Committed By:   rillig
Date:           Sat Aug 12 21:08:38 UTC 2023

Modified Files:
        src/usr.bin/xlint/lint1: emit1.c
        src/usr.bin/xlint/lint2: emit2.c

Log Message:
lint: remove redundant comments


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/xlint/lint1/emit1.c
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/xlint/lint2/emit2.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/emit1.c
diff -u src/usr.bin/xlint/lint1/emit1.c:1.74 src/usr.bin/xlint/lint1/emit1.c:1.75
--- src/usr.bin/xlint/lint1/emit1.c:1.74	Sat Aug 12 20:48:24 2023
+++ src/usr.bin/xlint/lint1/emit1.c	Sat Aug 12 21:08:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.74 2023/08/12 20:48:24 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.75 2023/08/12 21:08:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: emit1.c,v 1.74 2023/08/12 20:48:24 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.75 2023/08/12 21:08:37 rillig Exp $");
 #endif
 
 #include "lint1.h"
@@ -47,10 +47,9 @@ static	void	outtt(sym_t *, sym_t *);
 static	void	outfstrg(strg_t *);
 
 /*
- * Write type into the output buffer.
- * The type is written as a sequence of substrings, each of which describes a
- * node of type type_t
- * a node is encoded as follows:
+ * Write type into the output file, encoded as follows:
+ *	const			c
+ *	volatile		v
  *	_Bool			B
  *	_Complex float		s X
  *	_Complex double		X
@@ -84,10 +83,6 @@ static	void	outfstrg(strg_t *);
  *				1 n tag			tagged type
  *				2 n typename		only typedef name
  *				3 line.file.uniq	anonymous types
- *
- * spaces are only for better readability
- * additionally it is possible to prepend the characters 'c' (for const)
- * and 'v' (for volatile)
  */
 void
 outtype(const type_t *tp)
@@ -219,16 +214,13 @@ outsym(const sym_t *sym, scl_t sc, def_t
 	if (sc == STATIC)
 		outchar('s');
 
-	/* name of the symbol */
 	outname(sym->s_name);
 
-	/* renamed name of symbol, if necessary */
 	if (sym->s_rename != NULL) {
 		outchar('r');
 		outname(sym->s_rename);
 	}
 
-	/* type of the symbol */
 	outtype(sym->s_type);
 	outchar('\n');
 }
@@ -254,8 +246,6 @@ outfdef(const sym_t *fsym, const pos_t *
 	outchar('.');
 	outint(posp->p_line);
 
-	/* flags */
-
 	/* both SCANFLIKE and PRINTFLIKE imply VARARGS */
 	if (printflike_argnum != -1) {
 		nvararg = printflike_argnum;
@@ -301,7 +291,6 @@ outfdef(const sym_t *fsym, const pos_t *
 	/* name of function */
 	outname(fsym->s_name);
 
-	/* renamed name of function, if necessary */
 	if (fsym->s_rename != NULL) {
 		outchar('r');
 		outname(fsym->s_rename);
@@ -388,8 +377,7 @@ outcall(const tnode_t *tn, bool retval_u
 		}
 
 	}
-	/* return value discarded/used/ignored */
-	outchar((char)(retval_discarded ? 'd' : (retval_used ? 'u' : 'i')));
+	outchar((char)(retval_discarded ? 'd' : retval_used ? 'u' : 'i'));
 
 	/* name of the called function */
 	outname(tn->tn_left->tn_left->tn_sym->s_name);
@@ -572,10 +560,7 @@ outusg(const sym_t *sym)
 	outint(get_filename_id(curr_pos.p_file));
 	outchar('.');
 	outint(curr_pos.p_line);
-
-	/* necessary to delimit both numbers */
-	outchar('x');
-
+	outchar('x');		/* separate the two numbers */
 	outname(sym->s_name);
 	outchar('\n');
 }

Index: src/usr.bin/xlint/lint2/emit2.c
diff -u src/usr.bin/xlint/lint2/emit2.c:1.34 src/usr.bin/xlint/lint2/emit2.c:1.35
--- src/usr.bin/xlint/lint2/emit2.c:1.34	Sat Aug 12 20:48:24 2023
+++ src/usr.bin/xlint/lint2/emit2.c	Sat Aug 12 21:08:37 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: emit2.c,v 1.34 2023/08/12 20:48:24 rillig Exp $ */
+/* $NetBSD: emit2.c,v 1.35 2023/08/12 21:08:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: emit2.c,v 1.34 2023/08/12 20:48:24 rillig Exp $");
+__RCSID("$NetBSD: emit2.c,v 1.35 2023/08/12 21:08:37 rillig Exp $");
 #endif
 
 #include "lint2.h"
@@ -116,16 +116,11 @@ static void
 outdef(hte_t *hte, sym_t *sym)
 {
 
-	/* line number in C source file */
-	outint(0);
-
-	/* this is a definition */
-	outchar('d');
-
-	/* index of file where symbol was defined and line number of def. */
-	outint(0);
+	outint(0);		/* line number in C source file */
+	outchar('d');		/* definition */
+	outint(0);		/* index of file where symbol was defined */
 	outchar('.');
-	outint(0);
+	outint(0);		/* line number of definition */
 
 	/* flags */
 	if (sym->s_check_only_first_args) {
@@ -148,12 +143,8 @@ outdef(hte_t *hte, sym_t *sym)
 		if (sym->s_old_style_function)
 			outchar('o');
 	}
-	outchar('u');			/* used (no warning if not used) */
-
-	/* name */
+	outchar('u');		/* used (no warning if not used) */
 	outname(hte->h_name);
-
-	/* type */
 	outtype(TP(sym->s_type));
 	outchar('\n');
 }
@@ -196,28 +187,22 @@ dumpname(hte_t *hte)
 void
 outlib(const char *name)
 {
-	/* Open of output file and initialization of the output buffer */
+
 	outopen(name);
 
-	/* write name of lint library */
-	outsrc(name);
+	outsrc(name);		/* name of the lint library */
 
-	/* name of lint lib has index 0 */
-	outint(0);
+	outint(0);		/* filename index of the lint library */
 	outchar('s');
 	outstrg(name);
 	outchar('\n');
 
-	/*
-	 * print the names of all files referenced by unnamed
-	 * struct/union/enum declarations.
-	 */
+	/* All files referenced by unnamed struct/union/enum declarations. */
 	outfiles();
 
-	/* write all definitions with external linkage */
+	/* Write all definitions with external linkage. */
 	symtab_forall_sorted(dumpname);
 
-	/* close the output */
 	outclose();
 }
 

Reply via email to