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): rename dieQuietly to shouldDieQuietly



details:   https://anonhg.NetBSD.org/src/rev/7092f6fff5ec
branches:  trunk
changeset: 1015990:7092f6fff5ec
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Nov 06 21:20:31 2020 +0000

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

diffstat:

 usr.bin/make/job.c  |   8 ++++----
 usr.bin/make/main.c |  17 ++++++++---------
 usr.bin/make/make.h |   4 ++--
 3 files changed, 14 insertions(+), 15 deletions(-)

diffs (114 lines):

diff -r f2933a6509e6 -r 7092f6fff5ec usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Nov 06 21:12:19 2020 +0000
+++ b/usr.bin/make/job.c        Fri Nov 06 21:20:31 2020 +0000
@@ -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 @@
                    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 @@
        /* 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");
     }
diff -r f2933a6509e6 -r 7092f6fff5ec usr.bin/make/main.c
--- a/usr.bin/make/main.c       Fri Nov 06 21:12:19 2020 +0000
+++ b/usr.bin/make/main.c       Fri Nov 06 21:20:31 2020 +0000
@@ -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 @@
 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 @@
 
 /*
  * 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 @@
        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 @@
     }
 
     /* we generally want to keep quiet if a sub-make died */
-    if (dieQuietly(gn, -1))
+    if (shouldDieQuietly(gn, -1))
        return;
 
     if (s)
diff -r f2933a6509e6 -r 7092f6fff5ec usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Nov 06 21:12:19 2020 +0000
+++ b/usr.bin/make/make.h       Fri Nov 06 21:20:31 2020 +0000
@@ -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_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);



Home | Main Index | Thread Index | Old Index