Module Name:    src
Committed By:   rillig
Date:           Sat Aug 22 00:13:16 UTC 2020

Modified Files:
        src/usr.bin/make: lst.c

Log Message:
make(1): document the recently failed assertion in Lst_OpenS

In make, a list has a single iterator that can be used with Lst_Open,
Lst_Next and Lst_Close.  Because this is a single iterator, it doesn't
make sense to call Lst_Open twice in a row without the corresponding
Lst_Close.  Exactly this happens in jobs mode though.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/lst.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/lst.c
diff -u src/usr.bin/make/lst.c:1.18 src/usr.bin/make/lst.c:1.19
--- src/usr.bin/make/lst.c:1.18	Fri Aug 21 14:33:32 2020
+++ src/usr.bin/make/lst.c	Sat Aug 22 00:13:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.18 2020/08/21 14:33:32 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,15 +34,14 @@
 
 #include <assert.h>
 
-#include "lst.h"
-#include "make_malloc.h"
+#include "make.h"
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.18 2020/08/21 14:33:32 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.18 2020/08/21 14:33:32 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.19 2020/08/22 00:13:16 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -643,10 +642,7 @@ Lst_Open(Lst list)
     if (!LstValid(list)) {
 	return FAILURE;
     }
-    list->isOpen = TRUE;
-    list->lastAccess = LstIsEmpty(list) ? Head : Unknown;
-    list->curr = NULL;
-
+    Lst_OpenS(list);
     return SUCCESS;
 }
 
@@ -656,6 +652,14 @@ void
 Lst_OpenS(Lst list)
 {
     assert(LstValid(list));
+#if 0
+    /* XXX: This assertion fails for NetBSD's "build.sh -j1 tools", somewhere
+     * between "dependall ===> compat" and "dependall ===> binstall".
+     * Building without the "-j1" succeeds though. */
+    if (list->isOpen)
+	Parse_Error(PARSE_WARNING, "Internal inconsistency: list opened twice");
+    assert(!list->isOpen);
+#endif
 
     list->isOpen = TRUE;
     list->lastAccess = LstIsEmpty(list) ? Head : Unknown;

Reply via email to