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): inline Targ_Ignore and Targ_Silent



details:   https://anonhg.NetBSD.org/src/rev/ab499d6807e8
branches:  trunk
changeset: 979029:ab499d6807e8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 12 00:05:05 2020 +0000

description:
make(1): inline Targ_Ignore and Targ_Silent

Each of these functions was only used 2 times, and each of these calls
used a different part of the whole expression.

diffstat:

 usr.bin/make/compat.c  |   8 ++++----
 usr.bin/make/job.c     |  12 ++++++------
 usr.bin/make/nonints.h |   4 +---
 usr.bin/make/targ.c    |  27 ++-------------------------
 4 files changed, 13 insertions(+), 38 deletions(-)

diffs (143 lines):

diff -r 202bd430411f -r ab499d6807e8 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Fri Dec 11 23:00:59 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Dec 12 00:05:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.205 2020/12/10 20:49:11 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.206 2020/12/12 00:05:05 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.205 2020/12/10 20:49:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.206 2020/12/12 00:05:05 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -529,9 +529,9 @@
         * Alter our type to tell if errors should be ignored or things
         * should not be printed so CompatRunCommand knows what to do.
         */
-       if (Targ_Ignore(gn))
+       if (opts.ignoreErrors)
                gn->type |= OP_IGNORE;
-       if (Targ_Silent(gn))
+       if (opts.beSilent)
                gn->type |= OP_SILENT;
 
        if (Job_CheckCommands(gn, Fatal)) {
diff -r 202bd430411f -r ab499d6807e8 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Dec 11 23:00:59 2020 +0000
+++ b/usr.bin/make/job.c        Sat Dec 12 00:05:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.368 2020/12/11 22:33:06 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.369 2020/12/12 00:05:05 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.368 2020/12/11 22:33:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.369 2020/12/12 00:05:05 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1537,7 +1537,7 @@
 #ifdef USE_META
        if (useMeta) {
                meta_job_start(job, gn);
-               if (Targ_Silent(gn)) /* might have changed */
+               if (gn->type & OP_SILENT) /* might have changed */
                        job->echo = FALSE;
        }
 #endif
@@ -1589,9 +1589,9 @@
        job->tailCmds = NULL;
        job->status = JOB_ST_SET_UP;
 
-       job->special = special || (gn->type & OP_SPECIAL);
-       job->ignerr = Targ_Ignore(gn);
-       job->echo = !Targ_Silent(gn);
+       job->special = special || gn->type & OP_SPECIAL;
+       job->ignerr = opts.ignoreErrors || gn->type & OP_IGNORE;
+       job->echo = !(opts.beSilent || gn->type & OP_SILENT);
        job->xtraced = FALSE;
 
        /*
diff -r 202bd430411f -r ab499d6807e8 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Fri Dec 11 23:00:59 2020 +0000
+++ b/usr.bin/make/nonints.h    Sat Dec 12 00:05:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.165 2020/12/06 20:09:01 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.166 2020/12/12 00:05:05 rillig Exp $     */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -205,8 +205,6 @@
 GNode *Targ_NewInternalNode(const char *);
 GNode *Targ_GetEndNode(void);
 void Targ_FindList(GNodeList *, StringList *);
-Boolean Targ_Ignore(const GNode *);
-Boolean Targ_Silent(const GNode *);
 Boolean Targ_Precious(const GNode *);
 void Targ_SetMain(GNode *);
 void Targ_PrintCmds(GNode *);
diff -r 202bd430411f -r ab499d6807e8 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Fri Dec 11 23:00:59 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Dec 12 00:05:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.154 2020/12/07 23:59:59 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.155 2020/12/12 00:05:05 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -93,12 +93,6 @@
  *     Targ_FindList   Given a list of names, find nodes for all
  *                     of them, creating them as necessary.
  *
- *     Targ_Ignore     Return TRUE if errors should be ignored when
- *                     creating the given target.
- *
- *     Targ_Silent     Return TRUE if we should be silent when
- *                     creating the given target.
- *
  *     Targ_Precious   Return TRUE if the target is precious and
  *                     should not be removed if we are interrupted.
  *
@@ -119,7 +113,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.154 2020/12/07 23:59:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.155 2020/12/12 00:05:05 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -351,23 +345,6 @@
        }
 }
 
-/*
- * Return true if errors from shell commands should be ignored when
- * creating gn.
- */
-Boolean
-Targ_Ignore(const GNode *gn)
-{
-       return opts.ignoreErrors || gn->type & OP_IGNORE;
-}
-
-/* Return true if be silent when creating gn. */
-Boolean
-Targ_Silent(const GNode *gn)
-{
-       return opts.beSilent || gn->type & OP_SILENT;
-}
-
 /* See if the given target is precious. */
 Boolean
 Targ_Precious(const GNode *gn)



Home | Main Index | Thread Index | Old Index