Module Name: src
Committed By: rillig
Date: Tue Dec 8 21:34:49 UTC 2020
Modified Files:
src/usr.bin/make: job.c
Log Message:
make(1): in jobs mode, invert local variable noSpecials to run
To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 src/usr.bin/make/job.c
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.350 src/usr.bin/make/job.c:1.351
--- src/usr.bin/make/job.c:1.350 Tue Dec 8 20:17:18 2020
+++ src/usr.bin/make/job.c Tue Dec 8 21:34:49 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.350 2020/12/08 20:17:18 rillig Exp $ */
+/* $NetBSD: job.c,v 1.351 2020/12/08 21:34:49 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.350 2020/12/08 20:17:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.351 2020/12/08 21:34:49 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -792,10 +792,10 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla
static void
JobPrintSpecials(Job *const job, const char *const escCmd,
- Boolean const noSpecials, RunFlags *const inout_runFlags,
+ Boolean const run, RunFlags *const inout_runFlags,
const char **const inout_cmdTemplate)
{
- if (noSpecials)
+ if (!run)
inout_runFlags->ignerr = FALSE;
else if (commandShell->hasErrCtl)
JobPrintSpecialsErrCtl(job, inout_runFlags->echo);
@@ -829,11 +829,8 @@ static void
JobPrintCommand(Job *job, char *cmd)
{
const char *const cmdp = cmd;
- /*
- * true if we shouldn't worry about inserting special commands into
- * the input stream.
- */
- Boolean noSpecials;
+
+ Boolean run;
RunFlags runFlags;
/* Template to use when printing the command */
@@ -841,7 +838,7 @@ JobPrintCommand(Job *job, char *cmd)
char *cmdStart; /* Start of expanded command */
char *escCmd = NULL; /* Command with quotes/backticks escaped */
- noSpecials = !GNode_ShouldExecute(job->node);
+ run = GNode_ShouldExecute(job->node);
numCommands++;
@@ -853,7 +850,8 @@ JobPrintCommand(Job *job, char *cmd)
ParseRunOptions(&cmd, &runFlags);
- if (runFlags.always && noSpecials) {
+ /* The '+' command flag overrides the -n or -N options. */
+ if (runFlags.always && !run) {
/*
* We're not actually executing anything...
* but this one needs to be - use compat mode just for it.
@@ -873,7 +871,7 @@ JobPrintCommand(Job *job, char *cmd)
escCmd = EscapeShellDblQuot(cmd);
if (!runFlags.echo) {
- if (!(job->flags & JOB_SILENT) && !noSpecials &&
+ if (!(job->flags & JOB_SILENT) && run &&
commandShell->hasEchoCtl) {
JobPrintln(job, commandShell->echoOff);
} else {
@@ -883,8 +881,7 @@ JobPrintCommand(Job *job, char *cmd)
}
if (runFlags.ignerr) {
- JobPrintSpecials(job, escCmd, noSpecials, &runFlags,
- &cmdTemplate);
+ JobPrintSpecials(job, escCmd, run, &runFlags, &cmdTemplate);
} else {
/*