Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): document the recently failed assertion...



details:   https://anonhg.NetBSD.org/src/rev/d41ba3855236
branches:  trunk
changeset: 937575:d41ba3855236
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 00:13:16 2020 +0000

description:
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.

diffstat:

 usr.bin/make/lst.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r 2bbf7c9983c9 -r d41ba3855236 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Fri Aug 21 23:30:02 2020 +0000
+++ b/usr.bin/make/lst.c        Sat Aug 22 00:13:16 2020 +0000
@@ -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 @@
     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 @@
 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;



Home | Main Index | Thread Index | Old Index