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): fix MakePrintStatusList



details:   https://anonhg.NetBSD.org/src/rev/785971c0503f
branches:  trunk
changeset: 945159:785971c0503f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 22 21:53:01 2020 +0000

description:
make(1): fix MakePrintStatusList

The current unit tests don't cover a situation where there are more than
100 errors reported at once.  This fixes the bug introduced in the
previous commit, a few minutes ago.

diffstat:

 usr.bin/make/make.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (75 lines):

diff -r e72d332cf136 -r 785971c0503f usr.bin/make/make.c
--- a/usr.bin/make/make.c       Thu Oct 22 21:49:44 2020 +0000
+++ b/usr.bin/make/make.c       Thu Oct 22 21:53:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.174 2020/10/22 21:49:44 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.175 2020/10/22 21:53:01 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include    "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.174 2020/10/22 21:49:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.175 2020/10/22 21:53:01 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked = 1;
@@ -1038,12 +1038,12 @@
  * or not created due to an error in a lower level.
  * Callback function for Make_Run via Lst_ForEachUntil.
  */
-static int
+static Boolean
 MakePrintStatus(GNode *gn, int *errors)
 {
     if (gn->flags & DONECYCLE)
        /* We've completely processed this node before, don't do it again. */
-       return 0;
+       return FALSE;
 
     if (gn->unmade == 0) {
        gn->flags |= DONECYCLE;
@@ -1076,7 +1076,7 @@
                             gn->name, gn->cohort_num);
            break;
        }
-       return 0;
+       return FALSE;
     }
 
     DEBUG3(MAKE, "MakePrintStatus: %s%s has %d unmade children\n",
@@ -1091,7 +1091,7 @@
        MakePrintStatusList(gn->children, errors);
        /* Mark that this node needn't be processed again */
        gn->flags |= DONECYCLE;
-       return 0;
+       return FALSE;
     }
 
     /* Only output the error once per node */
@@ -1099,11 +1099,11 @@
     Error("Graph cycles through `%s%s'", gn->name, gn->cohort_num);
     if ((*errors)++ > 100)
        /* Abandon the whole error report */
-       return 1;
+       return TRUE;
 
     /* Reporting for our children will give the rest of the loop */
     MakePrintStatusList(gn->children, errors);
-    return 0;
+    return FALSE;
 }
 
 static void
@@ -1111,7 +1111,8 @@
 {
     GNodeListNode *ln;
     for (ln = gnodes->first; ln != NULL; ln = ln->next)
-        MakePrintStatus(ln->datum, errors);
+        if (MakePrintStatus(ln->datum, errors))
+           break;
 }
 
 /* Expand .USE nodes and create a new targets list.



Home | Main Index | Thread Index | Old Index