Mon Jan 4 22:26:51 2021 UTC ()
lint: fix typos and other minor stylistic issues


(rillig)
diff -r1.21 -r1.22 src/usr.bin/xlint/common/tyname.c
diff -r1.110 -r1.111 src/usr.bin/xlint/lint1/decl.c
diff -r1.33 -r1.34 src/usr.bin/xlint/lint1/emit1.c
diff -r1.49 -r1.50 src/usr.bin/xlint/lint1/func.c
diff -r1.52 -r1.53 src/usr.bin/xlint/lint1/lint1.h
diff -r1.31 -r1.32 src/usr.bin/xlint/lint1/main1.c
diff -r1.111 -r1.112 src/usr.bin/xlint/lint1/scan.l
diff -r1.126 -r1.127 src/usr.bin/xlint/lint1/tree.c
diff -r1.31 -r1.32 src/usr.bin/xlint/lint2/chk.c
diff -r1.9 -r1.10 src/usr.bin/xlint/lint2/main2.c
diff -r1.35 -r1.36 src/usr.bin/xlint/lint2/read.c
diff -r1.51 -r1.52 src/usr.bin/xlint/xlint/xlint.c

cvs diff -r1.21 -r1.22 src/usr.bin/xlint/common/tyname.c (expand / switch to context diff)
--- src/usr.bin/xlint/common/tyname.c 2021/01/03 15:55:18 1.21
+++ src/usr.bin/xlint/common/tyname.c 2021/01/04 22:26:50 1.22
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.21 2021/01/03 15:55:18 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.22 2021/01/04 22:26:50 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.21 2021/01/03 15:55:18 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.22 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -280,7 +280,7 @@
 #endif
 	}
 	if (tp->t_vararg) {
-		buf_add(buf, sep), sep = ", ";
+		buf_add(buf, sep);
 		buf_add(buf, "...");
 	}
 	buf_add(buf, ") returning ");

cvs diff -r1.110 -r1.111 src/usr.bin/xlint/lint1/decl.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/decl.c 2021/01/03 20:14:38 1.110
+++ src/usr.bin/xlint/lint1/decl.c 2021/01/04 22:26:50 1.111
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.110 2021/01/03 20:14:38 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.111 2021/01/04 22:26:50 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.110 2021/01/03 20:14:38 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.111 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -50,7 +50,7 @@
 
 const	char *unnamed = "<unnamed>";
 
-/* shared type structures for arithmtic types and void */
+/* shared type structures for arithmetic types and void */
 static	type_t	*typetab;
 
 /* value of next enumerator during declaration of enum types */
@@ -672,7 +672,7 @@
  *
  * This is used to mark compound statements which have, possibly in
  * nested compound statements, asm statements. For these compound
- * statements no warnings about unused or unitialized variables are
+ * statements no warnings about unused or uninitialized variables are
  * printed.
  *
  * There is no need to clear d_asm in dinfo structs with context AUTO,
@@ -877,7 +877,7 @@
 /*
  * Return the length of a type in bits.
  *
- * Printing a message if the outhermost dimension of an array is 0 must
+ * Printing a message if the outermost dimension of an array is 0 must
  * be done by the caller. All other problems are reported by length()
  * if name is not NULL.
  */
@@ -977,7 +977,7 @@
  * message if it is not.
  *
  * Invalid types are:
- * - arrays of incomlete types or functions
+ * - arrays of incomplete types or functions
  * - functions returning arrays or functions
  * - void types other than type of function or pointer
  */
@@ -1898,7 +1898,7 @@
 	if (plibflg && llibflg &&
 	    dsym->s_type->t_tspec == FUNC && dsym->s_type->t_proto) {
 		/*
-		 * With both LINTLIBRARY and PROTOLIB the prototyp is
+		 * With both LINTLIBRARY and PROTOLIB the prototype is
 		 * written as a function definition to the output file.
 		 */
 		rval = dsym->s_type->t_subt->t_tspec != VOID;

cvs diff -r1.33 -r1.34 src/usr.bin/xlint/lint1/emit1.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/emit1.c 2021/01/03 20:14:38 1.33
+++ src/usr.bin/xlint/lint1/emit1.c 2021/01/04 22:26:50 1.34
@@ -1,4 +1,4 @@
-/* $NetBSD: emit1.c,v 1.33 2021/01/03 20:14:38 rillig Exp $ */
+/* $NetBSD: emit1.c,v 1.34 2021/01/04 22:26:50 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.33 2021/01/03 20:14:38 rillig Exp $");
+__RCSID("$NetBSD: emit1.c,v 1.34 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -88,7 +88,7 @@
  *				2 n typename		only type name
  *
  * spaces are only for better readability
- * additionaly it is possible to prepend the characters 'c' (for const)
+ * additionally it is possible to prepend the characters 'c' (for const)
  * and 'v' (for volatile)
  */
 void
@@ -401,7 +401,7 @@
  * write out all information necessary for lint2 to check function
  * calls
  *
- * rvused is set if the return value is used (asigned to a variable)
+ * rvused is set if the return value is used (assigned to a variable)
  * rvdisc is set if the return value is not used and not ignored
  * (casted to void)
  */
@@ -490,7 +490,7 @@
 
 /*
  * extracts potential format specifiers for printf() and scanf() and
- * writes them, enclosed in "" and qouted if necessary, to the output buffer
+ * writes them, enclosed in "" and quoted if necessary, to the output buffer
  */
 static void
 outfstrg(strg_t *strg)

cvs diff -r1.49 -r1.50 src/usr.bin/xlint/lint1/func.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/func.c 2021/01/03 20:14:38 1.49
+++ src/usr.bin/xlint/lint1/func.c 2021/01/04 22:26:50 1.50
@@ -1,4 +1,4 @@
-/*	$NetBSD: func.c,v 1.49 2021/01/03 20:14:38 rillig Exp $	*/
+/*	$NetBSD: func.c,v 1.50 2021/01/04 22:26:50 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.49 2021/01/03 20:14:38 rillig Exp $");
+__RCSID("$NetBSD: func.c,v 1.50 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -62,7 +62,7 @@
 int	rchflg;
 
 /*
- * In conjunction with reached ontrols printing of "fallthrough on ..."
+ * In conjunction with reached, controls printing of "fallthrough on ..."
  * warnings.
  * Reset by each statement and set by FALLTHROUGH, switch (switch1())
  * and case (label()).
@@ -70,7 +70,7 @@
  * Control statements if, for, while and switch do not reset ftflg because
  * this must be done by the controlled statement. At least for if this is
  * important because ** FALLTHROUGH ** after "if (expr) stmnt" is evaluated
- * before the following token, wich causes reduction of above.
+ * before the following token, which causes reduction of above.
  * This means that ** FALLTHROUGH ** after "if ..." would always be ignored.
  */
 int	ftflg;
@@ -294,8 +294,12 @@
 			 * be printed in check_func_lint_directives().
 			 */
 			if (dowarn && !fsym->s_osdef) {
-				/* redeclaration of %s */
-				(*(sflag ? error : warning))(27, fsym->s_name);
+				if (sflag)
+					/* redeclaration of %s */
+					error(27, fsym->s_name);
+				else
+					/* redeclaration of %s */
+					warning(27, fsym->s_name);
 				print_previous_declaration(-1, rdsym);
 			}
 
@@ -1188,7 +1192,7 @@
 }
 
 /*
- * Set the linenumber for a CONSTCOND comment. At this and the following
+ * Set the line number for a CONSTCOND comment. At this and the following
  * line no warnings about constants in conditional contexts are printed.
  */
 /* ARGSUSED */

cvs diff -r1.52 -r1.53 src/usr.bin/xlint/lint1/lint1.h (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/lint1.h 2021/01/03 20:04:08 1.52
+++ src/usr.bin/xlint/lint1/lint1.h 2021/01/04 22:26:50 1.53
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.52 2021/01/03 20:04:08 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.53 2021/01/04 22:26:50 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -51,9 +51,9 @@
 #define WORST_ALIGN(x) (((x) + AVAL) & ~AVAL)
 #endif
 
-#define LWARN_BAD	-3
-#define LWARN_ALL	-2
-#define LWARN_NONE	-1
+#define LWARN_BAD	(-3)
+#define LWARN_ALL	(-2)
+#define LWARN_NONE	(-1)
 
 /*
  * Describes the position of a declaration or anything else.
@@ -116,7 +116,7 @@
 #define v_ldbl	v_u._v_ldbl
 
 /*
- * Structures of type str_t uniqely identify structures. This can't
+ * Structures of type str_t uniquely identify structures. This can't
  * be done in structures of type type_t, because these are copied
  * if they must be modified. So it would not be possible to check
  * if two structures are identical by comparing the pointers to

cvs diff -r1.31 -r1.32 src/usr.bin/xlint/lint1/main1.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/main1.c 2020/12/29 11:35:11 1.31
+++ src/usr.bin/xlint/lint1/main1.c 2021/01/04 22:26:50 1.32
@@ -1,4 +1,4 @@
-/*	$NetBSD: main1.c,v 1.31 2020/12/29 11:35:11 rillig Exp $	*/
+/*	$NetBSD: main1.c,v 1.32 2021/01/04 22:26:50 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.31 2020/12/29 11:35:11 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.32 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -55,7 +55,7 @@
 int	yflag;
 
 /*
- * Print warnings if an assignment of an integertype to another integertype
+ * Print warnings if an assignment of an integer type to another integer type
  * causes an implicit narrowing conversion. If aflag is 1, these warnings
  * are printed only if the source type is at least as wide as long. If aflag
  * is greater than 1, they are always printed.

cvs diff -r1.111 -r1.112 src/usr.bin/xlint/lint1/scan.l (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/scan.l 2021/01/03 17:42:45 1.111
+++ src/usr.bin/xlint/lint1/scan.l 2021/01/04 22:26:50 1.112
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.111 2021/01/03 17:42:45 rillig Exp $ */
+/* $NetBSD: scan.l,v 1.112 2021/01/04 22:26:50 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.111 2021/01/03 17:42:45 rillig Exp $");
+__RCSID("$NetBSD: scan.l,v 1.112 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1340,7 +1340,7 @@
 }
 
 /*
- * Strings are stored in a dynamically alloceted buffer and passed
+ * Strings are stored in a dynamically allocated buffer and passed
  * in yylval.y_xstrg to the parser. The parser or the routines called
  * by the parser are responsible for freeing this buffer.
  */

cvs diff -r1.126 -r1.127 src/usr.bin/xlint/lint1/tree.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint1/tree.c 2021/01/04 21:30:06 1.126
+++ src/usr.bin/xlint/lint1/tree.c 2021/01/04 22:26:50 1.127
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.126 2021/01/04 21:30:06 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.127 2021/01/04 22:26:50 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.126 2021/01/04 21:30:06 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.127 2021/01/04 22:26:50 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -1345,7 +1345,7 @@
 
 	/*
 	 * Enum as offset to a pointer is an exception (otherwise enums
-	 * could not be used as array indizes).
+	 * could not be used as array indices).
 	 */
 	if (op == PLUS &&
 	    ((ln->tn_type->t_isenum && rn->tn_type->t_tspec == PTR) ||

cvs diff -r1.31 -r1.32 src/usr.bin/xlint/lint2/chk.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint2/chk.c 2021/01/02 03:49:26 1.31
+++ src/usr.bin/xlint/lint2/chk.c 2021/01/04 22:26:51 1.32
@@ -1,4 +1,4 @@
-/* $NetBSD: chk.c,v 1.31 2021/01/02 03:49:26 rillig Exp $ */
+/* $NetBSD: chk.c,v 1.32 2021/01/04 22:26:51 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: chk.c,v 1.31 2021/01/02 03:49:26 rillig Exp $");
+__RCSID("$NetBSD: chk.c,v 1.32 2021/01/04 22:26:51 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -281,7 +281,7 @@
 		}
 		if (!eq || (sflag && dowarn)) {
 			pos1 = xstrdup(mkpos(&def->s_pos));
-			/* %s value used inconsistenty\t%s  ::  %s */
+			/* %s value used inconsistently\t%s  ::  %s */
 			msg(4, hte->h_name, pos1, mkpos(&call->f_pos));
 			free(pos1);
 		}
@@ -452,11 +452,11 @@
 	char	*pos1;
 
 	/*
-	 * If a function definition is available (def != NULL), we compair the
+	 * If a function definition is available (def != NULL), we compare the
 	 * function call (call) with the definition. Otherwise, if a function
 	 * definition is available and it is not an old style definition
-	 * (decl != NULL && TP(decl->s_type)->t_proto), we compair the call
-	 * with this declaration. Otherwise we compair it with the first
+	 * (decl != NULL && TP(decl->s_type)->t_proto), we compare the call
+	 * with this declaration. Otherwise we compare it with the first
 	 * call we have found (call1).
 	 */
 
@@ -464,7 +464,7 @@
 	promote = def != NULL && def->s_osdef;
 
 	/*
-	 * If we compair with a definition or declaration, we must perform
+	 * If we compare with a definition or declaration, we must perform
 	 * the same checks for qualifiers in indirected types as in
 	 * assignments.
 	 */
@@ -479,7 +479,7 @@
 	 * of an argument does not match exactly the expected type. The
 	 * result are lots of warnings which are really not necessary.
 	 * We print a warning only if
-	 *   (0) at least one type is not an interger type and types differ
+	 *   (0) at least one type is not an integer type and types differ
 	 *   (1) hflag is set and types differ
 	 *   (2) types differ, except in signedness
 	 * If the argument is an integer constant whose msb is not set,
@@ -487,7 +487,7 @@
 	 * int). This is with and without hflag.
 	 * If the argument is an integer constant with value 0 and the
 	 * expected argument is of type pointer and the width of the
-	 * interger constant is the same as the width of the pointer,
+	 * integer constant is the same as the width of the pointer,
 	 * no warning is printed.
 	 */
 	t1 = arg1->t_tspec;
@@ -496,7 +496,7 @@
 	    !arg1->t_isenum && !arg2->t_isenum) {
 		if (promote) {
 			/*
-			 * XXX Here is a problem: Althrough it is possible to
+			 * XXX Here is a problem: Although it is possible to
 			 * pass an int where a char/short it expected, there
 			 * may be loss in significant digits. We should first
 			 * check for const arguments if they can be converted
@@ -930,7 +930,7 @@
 		} else if (fc == 'X') {
 			/*
 			 * XXX valid in ANSI C, but in NetBSD's libc imple-
-			 * mented as "lx". Thats why it should be avoided.
+			 * mented as "lx". That's why it should be avoided.
 			 */
 			if (sz != NOTSPEC || !tflag)
 				badfmt(hte, call);
@@ -939,7 +939,7 @@
 		} else if (fc == 'E') {
 			/*
 			 * XXX valid in ANSI C, but in NetBSD's libc imple-
-			 * mented as "lf". Thats why it should be avoided.
+			 * mented as "lf". That's why it should be avoided.
 			 */
 			if (sz != NOTSPEC || !tflag)
 				badfmt(hte, call);
@@ -1079,7 +1079,7 @@
 		/*
 		 * XXX as soon as we are able to disable single warnings
 		 * the following dependencies from hflag should be removed.
-		 * but for now I do'nt want to be botherd by this warnings
+		 * but for now I don't want to be bothered by this warnings
 		 * which are almost always useless.
 		 */
 		if (hflag == 0)

cvs diff -r1.9 -r1.10 src/usr.bin/xlint/lint2/main2.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint2/main2.c 2016/09/05 00:40:30 1.9
+++ src/usr.bin/xlint/lint2/main2.c 2021/01/04 22:26:51 1.10
@@ -1,4 +1,4 @@
-/*	$NetBSD: main2.c,v 1.9 2016/09/05 00:40:30 sevan Exp $	*/
+/*	$NetBSD: main2.c,v 1.10 2021/01/04 22:26:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main2.c,v 1.9 2016/09/05 00:40:30 sevan Exp $");
+__RCSID("$NetBSD: main2.c,v 1.10 2021/01/04 22:26:51 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -72,7 +72,7 @@
 
 /*
  * If a complaint stems from a included file, print the name of the included
- * file instead of the name spezified at the command line followed by '?'
+ * file instead of the name specified at the command line followed by '?'
  */
 int	Hflag;
 

cvs diff -r1.35 -r1.36 src/usr.bin/xlint/lint2/read.c (expand / switch to context diff)
--- src/usr.bin/xlint/lint2/read.c 2021/01/01 11:51:15 1.35
+++ src/usr.bin/xlint/lint2/read.c 2021/01/04 22:26:51 1.36
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.35 2021/01/01 11:51:15 rillig Exp $ */
+/* $NetBSD: read.c,v 1.36 2021/01/04 22:26:51 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: read.c,v 1.35 2021/01/01 11:51:15 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.36 2021/01/04 22:26:51 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -62,7 +62,7 @@
 static	size_t	ninpfns;
 
 /*
- * The array pointed to by *fnames maps file name indizes to file names.
+ * The array pointed to by *fnames maps file name indices to file names.
  * Indices of type short are used instead of pointers to save memory.
  */
 const	char **fnames;
@@ -87,7 +87,7 @@
 
 static	hte_t **renametab;
 
-/* index of current C source file (as spezified at the command line) */
+/* index of current C source file (as specified at the command line) */
 static	int	csrcfile;
 
 
@@ -498,7 +498,7 @@
 	}
 
 	if (symp == NULL) {
-		/* allocsym reserviert keinen Platz fuer s_nva */
+		/* allocsym does not reserve space for s_nva */
 		if (sym.s_va || sym.s_prfl || sym.s_scfl) {
 			symp = xalloc(sizeof (sym_t));
 			*symp = sym;
@@ -519,7 +519,7 @@
 }
 
 /*
- * Read an u-record (emited by lint1 if a symbol was used).
+ * Read an u-record (emitted by lint1 if a symbol was used).
  */
 static void
 usedsym(pos_t *posp, const char *cp)

cvs diff -r1.51 -r1.52 src/usr.bin/xlint/xlint/xlint.c (expand / switch to context diff)
--- src/usr.bin/xlint/xlint/xlint.c 2020/12/29 11:35:11 1.51
+++ src/usr.bin/xlint/xlint/xlint.c 2021/01/04 22:26:51 1.52
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.51 2020/12/29 11:35:11 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.52 2021/01/04 22:26:51 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: xlint.c,v 1.51 2020/12/29 11:35:11 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.52 2021/01/04 22:26:51 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -82,7 +82,7 @@
 /* flags always passed to cc(1) */
 static	char	**cflags;
 
-/* flags for cc(1), controled by sflag/tflag */
+/* flags for cc(1), controlled by sflag/tflag */
 static	char	**lcflags;
 
 /* flags for lint1 */