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.
This commit is contained in:
rillig 2020-12-12 00:05:05 +00:00
parent ad7305d632
commit f650bd93fa
4 changed files with 13 additions and 38 deletions

View File

@ -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 @@ MakeUnmade(GNode *const gn, GNode *const pgn)
* 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)) {

View File

@ -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 @@ JobOpenTmpFile(Job *job, GNode *gn, Boolean cmdsOK, Boolean *out_run)
#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 @@ JobStart(GNode *gn, Boolean special)
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;
/*

View File

@ -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_GetNode(const char *);
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 *);

View File

@ -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 @@ Targ_FindList(GNodeList *gns, StringList *names)
}
}
/*
* 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)