Module Name:    src
Committed By:   rillig
Date:           Sat Aug 22 11:35:00 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c compat.c dir.c job.c main.c make.c parse.c
            suff.c targ.c

Log Message:
make(1): replace "(void)Lst_AtEnd" with stricter "Lst_AppendS"

This change ensures that there is actually something added to the list.
Lst_AtEnd had silently skipped the addition if the list was invalid
(null pointer), which was not intended in these cases.  The "(void)" is
assumed to mean "I know that this cannot fail", while it could also mean
"I don't care whether something actually happened".

Running "./build.sh -j6 tools" still succeeds after this change,
therefore chances are very low that this change breaks anything.  If
there is any change, it's an obvious assertion failure.  There is no
silent change in behavior though.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/usr.bin/make/arch.c
cvs rdiff -u -r1.121 -r1.122 src/usr.bin/make/compat.c
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/make/dir.c
cvs rdiff -u -r1.209 -r1.210 src/usr.bin/make/job.c
cvs rdiff -u -r1.306 -r1.307 src/usr.bin/make/main.c
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/make.c
cvs rdiff -u -r1.252 -r1.253 src/usr.bin/make/parse.c
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/make/suff.c
cvs rdiff -u -r1.67 -r1.68 src/usr.bin/make/targ.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/make/arch.c
diff -u src/usr.bin/make/arch.c:1.86 src/usr.bin/make/arch.c:1.87
--- src/usr.bin/make/arch.c:1.86	Fri Aug 21 04:42:02 2020
+++ src/usr.bin/make/arch.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.86 2020/08/21 04:42:02 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.87 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.86 2020/08/21 04:42:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.87 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.86 2020/08/21 04:42:02 rillig Exp $");
+__RCSID("$NetBSD: arch.c,v 1.87 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -377,7 +377,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 		    return FAILURE;
 		} else {
 		    gn->type |= OP_ARCHV;
-		    (void)Lst_AtEnd(nodeLst, gn);
+		    Lst_AppendS(nodeLst, gn);
 		}
 	    } else if (Arch_ParseArchive(&sacrifice, nodeLst, ctxt)!=SUCCESS) {
 		/*
@@ -419,7 +419,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 		     * end of the provided list.
 		     */
 		    gn->type |= OP_ARCHV;
-		    (void)Lst_AtEnd(nodeLst, gn);
+		    Lst_AppendS(nodeLst, gn);
 		}
 	    }
 	    Lst_Destroy(members, NULL);
@@ -441,7 +441,7 @@ Arch_ParseArchive(char **linePtr, Lst no
 		 * provided list.
 		 */
 		gn->type |= OP_ARCHV;
-		(void)Lst_AtEnd(nodeLst, gn);
+		Lst_AppendS(nodeLst, gn);
 	    }
 	}
 	if (doSubst) {
@@ -694,7 +694,7 @@ ArchStatMember(const char *archive, cons
 
     fclose(arch);
 
-    (void)Lst_AtEnd(archives, ar);
+    Lst_AppendS(archives, ar);
 
     /*
      * Now that the archive has been read and cached, we can look into

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.121 src/usr.bin/make/compat.c:1.122
--- src/usr.bin/make/compat.c:1.121	Sat Aug 22 10:07:29 2020
+++ src/usr.bin/make/compat.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.121 2020/08/22 10:07:29 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.122 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.121 2020/08/22 10:07:29 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.122 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.121 2020/08/22 10:07:29 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.122 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -250,7 +250,7 @@ CompatRunCommand(void *cmdp, void *gnp)
     Lst_ReplaceS(cmdNode, cmdStart);
 
     if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
-	(void)Lst_AtEnd(ENDNode->commands, cmdStart);
+	Lst_AppendS(ENDNode->commands, cmdStart);
 	return 0;
     }
     if (strcmp(cmdStart, "...") == 0) {

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.99 src/usr.bin/make/dir.c:1.100
--- src/usr.bin/make/dir.c:1.99	Sat Aug 22 09:40:18 2020
+++ src/usr.bin/make/dir.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.99 2020/08/22 09:40:18 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.100 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.99 2020/08/22 09:40:18 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.100 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c	8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.99 2020/08/22 09:40:18 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.100 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -641,9 +641,9 @@ DirMatchFiles(const char *pattern, Path 
 	    ((entry->name[0] != '.') ||
 	     (pattern[0] == '.')))
 	{
-	    (void)Lst_AtEnd(expansions,
-			    (isDot ? bmake_strdup(entry->name) :
-			     str_concat3(p->name, "/", entry->name)));
+	    Lst_AppendS(expansions,
+			(isDot ? bmake_strdup(entry->name) :
+			 str_concat3(p->name, "/", entry->name)));
 	}
     }
 }
@@ -1582,7 +1582,7 @@ Dir_AddDir(Lst path, const char *name)
 	p = (Path *)Lst_Datum(ln);
 	if (path && Lst_Member(path, p) == NULL) {
 	    p->refCount += 1;
-	    (void)Lst_AtEnd(path, p);
+	    Lst_AppendS(path, p);
 	}
     } else {
 	DIR_DEBUG1("Caching %s ...", name);
@@ -1608,9 +1608,9 @@ Dir_AddDir(Lst path, const char *name)
 		(void)Hash_CreateEntry(&p->files, dp->d_name, NULL);
 	    }
 	    (void)closedir(d);
-	    (void)Lst_AtEnd(openDirectories, p);
+	    Lst_AppendS(openDirectories, p);
 	    if (path != NULL)
-		(void)Lst_AtEnd(path, p);
+		Lst_AppendS(path, p);
 	}
 	DIR_DEBUG0("done\n");
     }
@@ -1773,7 +1773,7 @@ Dir_Concat(Lst path1, Lst path2)
 	p = (Path *)Lst_Datum(ln);
 	if (Lst_Member(path1, p) == NULL) {
 	    p->refCount += 1;
-	    (void)Lst_AtEnd(path1, p);
+	    Lst_AppendS(path1, p);
 	}
     }
 }

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.209 src/usr.bin/make/job.c:1.210
--- src/usr.bin/make/job.c:1.209	Sat Aug 22 09:51:57 2020
+++ src/usr.bin/make/job.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.209 2020/08/22 09:51:57 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.210 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.209 2020/08/22 09:51:57 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.210 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.209 2020/08/22 09:51:57 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.210 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -918,7 +918,7 @@ static int
 JobSaveCommand(void *cmd, void *gn)
 {
     cmd = Var_Subst((char *)cmd, (GNode *)gn, VARE_WANTRES);
-    (void)Lst_AtEnd(postCommands->commands, cmd);
+    Lst_AppendS(postCommands->commands, cmd);
     return 0;
 }
 

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.306 src/usr.bin/make/main.c:1.307
--- src/usr.bin/make/main.c:1.306	Sat Aug 22 00:48:02 2020
+++ src/usr.bin/make/main.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.306 2020/08/22 00:48:02 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.306 2020/08/22 00:48:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.306 2020/08/22 00:48:02 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.307 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -543,7 +543,7 @@ rearg:
 		case 'v':
 			if (argvalue == NULL) goto noarg;
 			printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
-			(void)Lst_AtEnd(variables, argvalue);
+			Lst_AppendS(variables, argvalue);
 			Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
 			Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
 			break;
@@ -571,7 +571,7 @@ rearg:
 			break;
 		case 'f':
 			if (argvalue == NULL) goto noarg;
-			(void)Lst_AtEnd(makefiles, argvalue);
+			Lst_AppendS(makefiles, argvalue);
 			break;
 		case 'i':
 			ignoreErrors = TRUE;
@@ -660,7 +660,7 @@ rearg:
 				Punt("illegal (null) argument.");
 			if (*argv[1] == '-' && !dashDash)
 				goto rearg;
-			(void)Lst_AtEnd(create, bmake_strdup(argv[1]));
+			Lst_AppendS(create, bmake_strdup(argv[1]));
 		}
 
 	return;
@@ -810,7 +810,7 @@ str2Lst_Append(Lst lp, char *str, const 
 	sep = " \t";
 
     for (n = 0, cp = strtok(str, sep); cp; cp = strtok(NULL, sep)) {
-	(void)Lst_AtEnd(lp, cp);
+	Lst_AppendS(lp, cp);
 	n++;
     }
     return n;

Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.109 src/usr.bin/make/make.c:1.110
--- src/usr.bin/make/make.c:1.109	Sat Aug 22 08:40:03 2020
+++ src/usr.bin/make/make.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.c,v 1.109 2020/08/22 08:40:03 rillig Exp $	*/
+/*	$NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: make.c,v 1.109 2020/08/22 08:40:03 rillig Exp $";
+static char rcsid[] = "$NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)make.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: make.c,v 1.109 2020/08/22 08:40:03 rillig Exp $");
+__RCSID("$NetBSD: make.c,v 1.110 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -479,8 +479,8 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
 		    gn = tgn;
 	    }
 
-	    (void)Lst_AtEnd(pgn->children, gn);
-	    (void)Lst_AtEnd(gn->parents, pgn);
+	    Lst_AppendS(pgn->children, gn);
+	    Lst_AppendS(gn->parents, pgn);
 	    pgn->unmade += 1;
 	}
 	Lst_CloseS(cgn->children);

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.252 src/usr.bin/make/parse.c:1.253
--- src/usr.bin/make/parse.c:1.252	Fri Aug 21 02:20:47 2020
+++ src/usr.bin/make/parse.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.252 2020/08/21 02:20:47 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.253 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.252 2020/08/21 02:20:47 rillig Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.253 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.252 2020/08/21 02:20:47 rillig Exp $");
+__RCSID("$NetBSD: parse.c,v 1.253 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -856,9 +856,9 @@ ParseLinkSrc(void *pgnp, void *cgnp)
 
     if ((pgn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (pgn->cohorts))
 	pgn = (GNode *)Lst_Datum(Lst_Last(pgn->cohorts));
-    (void)Lst_AtEnd(pgn->children, cgn);
+    Lst_AppendS(pgn->children, cgn);
     if (specType == Not)
-	    (void)Lst_AtEnd(cgn->parents, pgn);
+	Lst_AppendS(cgn->parents, pgn);
     pgn->unmade += 1;
     if (DEBUG(PARSE)) {
 	fprintf(debug_file, "# %s: added child %s - %s\n", __func__,
@@ -934,7 +934,7 @@ ParseDoOp(void *gnp, void *opp)
 	 * traversals will no longer see this node anyway. -mycroft)
 	 */
 	cohort->type = op | OP_INVISIBLE;
-	(void)Lst_AtEnd(gn->cohorts, cohort);
+	Lst_AppendS(gn->cohorts, cohort);
 	cohort->centurion = gn;
 	gn->unmade_cohorts += 1;
 	snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
@@ -1017,7 +1017,7 @@ ParseDoSrc(int tOp, const char *src)
 	 * invoked if the user didn't specify a target on the command
 	 * line. This is to allow #ifmake's to succeed, or something...
 	 */
-	(void)Lst_AtEnd(create, bmake_strdup(src));
+	Lst_AppendS(create, bmake_strdup(src));
 	/*
 	 * Add the name to the .TARGETS variable as well, so the user can
 	 * employ that, if desired.
@@ -1034,8 +1034,8 @@ ParseDoSrc(int tOp, const char *src)
 	if (doing_depend)
 	    ParseMark(gn);
 	if (predecessor != NULL) {
-	    (void)Lst_AtEnd(predecessor->order_succ, gn);
-	    (void)Lst_AtEnd(gn->order_pred, predecessor);
+	    Lst_AppendS(predecessor->order_succ, gn);
+	    Lst_AppendS(gn->order_pred, predecessor);
 	    if (DEBUG(PARSE)) {
 		fprintf(debug_file, "# %s: added Order dependency %s - %s\n",
 		    __func__, predecessor->name, gn->name);
@@ -1356,7 +1356,7 @@ ParseDoDependency(char *line)
 		    if (paths == NULL) {
 			paths = Lst_Init();
 		    }
-		    (void)Lst_AtEnd(paths, dirSearchPath);
+		    Lst_AppendS(paths, dirSearchPath);
 		    break;
 		case Main:
 		    if (!Lst_IsEmpty(create)) {
@@ -1372,12 +1372,12 @@ ParseDoDependency(char *line)
 		    if (doing_depend)
 			ParseMark(gn);
 		    gn->type |= OP_NOTMAIN|OP_SPECIAL;
-		    (void)Lst_AtEnd(targets, gn);
+		    Lst_AppendS(targets, gn);
 		    break;
 		case Default:
 		    gn = Targ_NewGN(".DEFAULT");
 		    gn->type |= (OP_NOTMAIN|OP_TRANSFORM);
-		    (void)Lst_AtEnd(targets, gn);
+		    Lst_AppendS(targets, gn);
 		    DEFAULT = gn;
 		    break;
 		case DeleteOnError:
@@ -1414,7 +1414,7 @@ ParseDoDependency(char *line)
 		    if (paths == NULL) {
 			paths = Lst_Init();
 		    }
-		    (void)Lst_AtEnd(paths, path);
+		    Lst_AppendS(paths, path);
 		}
 	    }
 	}
@@ -1441,7 +1441,7 @@ ParseDoDependency(char *line)
 		 * No wildcards, but we want to avoid code duplication,
 		 * so create a list with the word on it.
 		 */
-		(void)Lst_AtEnd(curTargs, line);
+		Lst_AppendS(curTargs, line);
 	    }
 
 	    /* Apply the targets. */
@@ -1457,7 +1457,7 @@ ParseDoDependency(char *line)
 		if (doing_depend)
 		    ParseMark(gn);
 
-		(void)Lst_AtEnd(targets, gn);
+		Lst_AppendS(targets, gn);
 	    }
 	} else if (specType == ExPath && *line != '.' && *line != '\0') {
 	    Parse_Error(PARSE_WARNING, "Extra target (%s) ignored", line);
@@ -2088,14 +2088,14 @@ ParseAddCmd(void *gnp, void *cmd)
 
     /* if target already supplied, ignore commands */
     if (!(gn->type & OP_HAS_COMMANDS)) {
-	(void)Lst_AtEnd(gn->commands, cmd);
+	Lst_AppendS(gn->commands, cmd);
 	if (ParseMaybeSubMake(cmd))
 	    gn->type |= OP_SUBMAKE;
 	ParseMark(gn);
     } else {
 #ifdef notyet
 	/* XXX: We cannot do this until we fix the tree */
-	(void)Lst_AtEnd(gn->commands, cmd);
+	Lst_AppendS(gn->commands, cmd);
 	Parse_Error(PARSE_WARNING,
 		     "overriding commands for target \"%s\"; "
 		     "previous commands defined at %s: %d ignored",
@@ -3333,11 +3333,11 @@ Parse_MainName(void)
 	Punt("no target to make.");
 	/*NOTREACHED*/
     } else if (mainNode->type & OP_DOUBLEDEP) {
-	(void)Lst_AtEnd(mainList, mainNode);
+	Lst_AppendS(mainList, mainNode);
 	Lst_Concat(mainList, mainNode->cohorts, LST_CONCNEW);
     }
     else
-	(void)Lst_AtEnd(mainList, mainNode);
+	Lst_AppendS(mainList, mainNode);
     Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL);
     return mainList;
 }

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.101 src/usr.bin/make/suff.c:1.102
--- src/usr.bin/make/suff.c:1.101	Sat Aug 22 08:01:34 2020
+++ src/usr.bin/make/suff.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.101 2020/08/22 08:01:34 rillig Exp $	*/
+/*	$NetBSD: suff.c,v 1.102 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.101 2020/08/22 08:01:34 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.102 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.101 2020/08/22 08:01:34 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.102 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -515,16 +515,16 @@ SuffInsert(Lst l, Suff *s)
 	if (DEBUG(SUFF)) {
 	    fprintf(debug_file, "at end of list\n");
 	}
-	(void)Lst_AtEnd(l, s);
+	Lst_AppendS(l, s);
 	s->refCount++;
-	(void)Lst_AtEnd(s->ref, l);
+	Lst_AppendS(s->ref, l);
     } else if (s2->sNum != s->sNum) {
 	if (DEBUG(SUFF)) {
 	    fprintf(debug_file, "before %s(%d)\n", s2->name, s2->sNum);
 	}
 	(void)Lst_InsertBefore(l, ln, s);
 	s->refCount++;
-	(void)Lst_AtEnd(s->ref, l);
+	Lst_AppendS(s->ref, l);
     } else if (DEBUG(SUFF)) {
 	fprintf(debug_file, "already there\n");
     }
@@ -710,7 +710,7 @@ Suff_AddTransform(char *line)
 	 * by the Parse module.
 	 */
 	gn = Targ_NewGN(line);
-	(void)Lst_AtEnd(transforms, gn);
+	Lst_AppendS(transforms, gn);
     } else {
 	/*
 	 * New specification for transformation rule. Just nuke the old list
@@ -993,7 +993,7 @@ Suff_AddSuffix(char *str, GNode **gn)
 	s->flags =  	0;
 	s->refCount =	1;
 
-	(void)Lst_AtEnd(sufflist, s);
+	Lst_AppendS(sufflist, s);
 	/*
 	 * We also look at our existing targets list to see if adding
 	 * this suffix will make one of our current targets mutate into
@@ -1210,7 +1210,7 @@ SuffAddSrc(void *sp, void *lsp)
 	s->refCount++;
 	s2->children =	0;
 	targ->children += 1;
-	(void)Lst_AtEnd(ls->l, s2);
+	Lst_AppendS(ls->l, s2);
 #ifdef DEBUG_SRC
 	s2->cp = Lst_Init();
 	Lst_AtEnd(targ->cp, s2);
@@ -1228,7 +1228,7 @@ SuffAddSrc(void *sp, void *lsp)
     s->refCount++;
     s2->children =  0;
     targ->children += 1;
-    (void)Lst_AtEnd(ls->l, s2);
+    Lst_AppendS(ls->l, s2);
 #ifdef DEBUG_SRC
     s2->cp = Lst_Init();
     Lst_AtEnd(targ->cp, s2);
@@ -1589,7 +1589,7 @@ SuffExpandChildren(LstNode cln, GNode *p
 		     */
 		    *cp++ = '\0';
 		    gn = Targ_FindNode(start, TARG_CREATE);
-		    (void)Lst_AtEnd(members, gn);
+		    Lst_AppendS(members, gn);
 		    while (*cp == ' ' || *cp == '\t') {
 			cp++;
 		    }
@@ -1627,7 +1627,7 @@ SuffExpandChildren(LstNode cln, GNode *p
 		 * Stuff left over -- add it to the list too
 		 */
 		gn = Targ_FindNode(start, TARG_CREATE);
-		(void)Lst_AtEnd(members, gn);
+		Lst_AppendS(members, gn);
 	    }
 	    /*
 	     * Point cp back at the beginning again so the variable value
@@ -1647,7 +1647,7 @@ SuffExpandChildren(LstNode cln, GNode *p
 	    }
 	    /* Add gn to the parents child list before the original child */
 	    (void)Lst_InsertBefore(pgn->children, cln, gn);
-	    (void)Lst_AtEnd(gn->parents, pgn);
+	    Lst_AppendS(gn->parents, pgn);
 	    pgn->unmade++;
 	    /* Expand wildcards on new node */
 	    SuffExpandWildcards(Lst_Prev(cln), pgn);
@@ -1702,7 +1702,7 @@ SuffExpandWildcards(LstNode cln, GNode *
 
 	/* Add gn to the parents child list before the original child */
 	(void)Lst_InsertBefore(pgn->children, cln, gn);
-	(void)Lst_AtEnd(gn->parents, pgn);
+	Lst_AppendS(gn->parents, pgn);
 	pgn->unmade++;
     }
 
@@ -1811,8 +1811,8 @@ SuffApplyTransform(GNode *tGn, GNode *sG
     /*
      * Form the proper links between the target and source.
      */
-    (void)Lst_AtEnd(tGn->children, sGn);
-    (void)Lst_AtEnd(sGn->parents, tGn);
+    Lst_AppendS(tGn->children, sGn);
+    Lst_AppendS(sGn->parents, tGn);
     tGn->unmade += 1;
 
     /*
@@ -1859,7 +1859,7 @@ SuffApplyTransform(GNode *tGn, GNode *sG
      * Keep track of another parent to which this beast is transformed so
      * the .IMPSRC variable can be set correctly for the parent.
      */
-    (void)Lst_AtEnd(sGn->iParents, tGn);
+    Lst_AppendS(sGn->iParents, tGn);
 
     return TRUE;
 }
@@ -1929,8 +1929,8 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
     /*
      * Create the link between the two nodes right off
      */
-    (void)Lst_AtEnd(gn->children, mem);
-    (void)Lst_AtEnd(mem->parents, gn);
+    Lst_AppendS(gn->children, mem);
+    Lst_AppendS(mem->parents, gn);
     gn->unmade += 1;
 
     /*
@@ -2136,7 +2136,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
 		/*
 		 * Record the target so we can nuke it
 		 */
-		(void)Lst_AtEnd(targs, targ);
+		Lst_AppendS(targs, targ);
 
 		/*
 		 * Search from this suffix's successor...
@@ -2181,7 +2181,7 @@ SuffFindNormalDeps(GNode *gn, Lst slst)
 	    if (DEBUG(SUFF))
 		fprintf(debug_file, "adding suffix rules\n");
 
-	    (void)Lst_AtEnd(targs, targ);
+	    Lst_AppendS(targs, targ);
 	}
 
 	/*

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.67 src/usr.bin/make/targ.c:1.68
--- src/usr.bin/make/targ.c:1.67	Fri Aug 21 04:42:02 2020
+++ src/usr.bin/make/targ.c	Sat Aug 22 11:35:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.67 2020/08/21 04:42:02 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.68 2020/08/22 11:35:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: targ.c,v 1.67 2020/08/21 04:42:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: targ.c,v 1.68 2020/08/22 11:35:00 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)targ.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: targ.c,v 1.67 2020/08/21 04:42:02 rillig Exp $");
+__RCSID("$NetBSD: targ.c,v 1.68 2020/08/22 11:35:00 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -360,7 +360,7 @@ Targ_FindNode(const char *name, int flag
     if (!(flags & TARG_NOHASH))
 	Hash_SetValue(he, gn);
     Var_Append(".ALLTARGETS", name, VAR_GLOBAL);
-    (void)Lst_AtEnd(allTargets, gn);
+    Lst_AppendS(allTargets, gn);
     if (doing_depend)
 	gn->flags |= FROM_DEPEND;
     return gn;
@@ -405,7 +405,7 @@ Targ_FindList(Lst names, int flags)
 	     * are added to the list in the order in which they were
 	     * encountered in the makefile.
 	     */
-	    (void)Lst_AtEnd(nodes, gn);
+	    Lst_AppendS(nodes, gn);
 	} else if (flags == TARG_NOCREATE) {
 	    Error("\"%s\" -- target unknown.", name);
 	}

Reply via email to