Module Name:    src
Committed By:   rillig
Date:           Fri Nov  6 21:20:31 UTC 2020

Modified Files:
        src/usr.bin/make: job.c main.c make.h

Log Message:
make(1): rename dieQuietly to shouldDieQuietly

It was too confusing to have a function named die that doesn't actually
die.  Plus, the return type int didn't give any clue about what the
function actually returns.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/usr.bin/make/job.c
cvs rdiff -u -r1.428 -r1.429 src/usr.bin/make/main.c
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/make/make.h

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/job.c
diff -u src/usr.bin/make/job.c:1.303 src/usr.bin/make/job.c:1.304
--- src/usr.bin/make/job.c:1.303	Thu Nov  5 17:27:16 2020
+++ src/usr.bin/make/job.c	Fri Nov  6 21:20:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.303 2020/11/05 17:27:16 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.304 2020/11/06 21:20:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.303 2020/11/05 17:27:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.304 2020/11/06 21:20:31 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1028,7 +1028,7 @@ JobFinish(Job *job, int status)
 		    meta_job_error(job, job->node, job->flags, WEXITSTATUS(status));
 		}
 #endif
-		if (!dieQuietly(job->node, -1))
+		if (!shouldDieQuietly(job->node, -1))
 		    (void)printf("*** [%s] Error code %d%s\n",
 				 job->node->name,
 				 WEXITSTATUS(status),
@@ -2767,7 +2767,7 @@ Job_TokenWithdraw(void)
 	/* And put the stopper back */
 	while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN)
 	    continue;
-	if (dieQuietly(NULL, 1))
+	if (shouldDieQuietly(NULL, 1))
 	    exit(2);
 	Fatal("A failure has been detected in another branch of the parallel make");
     }

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.428 src/usr.bin/make/main.c:1.429
--- src/usr.bin/make/main.c:1.428	Fri Nov  6 21:01:43 2020
+++ src/usr.bin/make/main.c	Fri Nov  6 21:20:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.428 2020/11/06 21:01:43 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.429 2020/11/06 21:20:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.428 2020/11/06 21:01:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.429 2020/11/06 21:20:31 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1891,7 +1891,7 @@ DieHorribly(void)
 void
 Finish(int errs)
 {
-	if (dieQuietly(NULL, -1))
+	if (shouldDieQuietly(NULL, -1))
 		exit(2);
 	Fatal("%d error%s", errs, errs == 1 ? "" : "s");
 }
@@ -2042,11 +2042,10 @@ cached_realpath(const char *pathname, ch
 
 /*
  * Return true if we should die without noise.
- * For example our failing child was a sub-make
- * or failure happend elsewhere.
+ * For example our failing child was a sub-make or failure happened elsewhere.
  */
-int
-dieQuietly(GNode *gn, int bf)
+Boolean
+shouldDieQuietly(GNode *gn, int bf)
 {
     static int quietly = -1;
 
@@ -2056,7 +2055,7 @@ dieQuietly(GNode *gn, int bf)
 	else if (bf >= 0)
 	    quietly = bf;
 	else
-	    quietly = gn != NULL ? ((gn->type  & (OP_MAKE)) != 0) : 0;
+	    quietly = gn != NULL && (gn->type & OP_MAKE);
     }
     return quietly;
 }
@@ -2094,7 +2093,7 @@ PrintOnError(GNode *gn, const char *s)
     }
 
     /* we generally want to keep quiet if a sub-make died */
-    if (dieQuietly(gn, -1))
+    if (shouldDieQuietly(gn, -1))
 	return;
 
     if (s)

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.193 src/usr.bin/make/make.h:1.194
--- src/usr.bin/make/make.h:1.193	Fri Nov  6 21:12:19 2020
+++ src/usr.bin/make/make.h	Fri Nov  6 21:20:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.193 2020/11/06 21:12:19 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.194 2020/11/06 21:20:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -643,7 +643,7 @@ void Make_HandleUse(GNode *, GNode *);
 void Make_Update(GNode *);
 void Make_DoAllVar(GNode *);
 Boolean Make_Run(GNodeList *);
-int dieQuietly(GNode *, int);
+Boolean shouldDieQuietly(GNode *, int);
 void PrintOnError(GNode *, const char *);
 void Main_ExportMAKEFLAGS(Boolean);
 Boolean Main_SetObjdir(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2);

Reply via email to