Module Name:    src
Committed By:   rillig
Date:           Tue Dec  8 20:10:24 UTC 2020

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

Log Message:
make(1): move flags errOff into RunFlags.ignerr


To generate a diff of this commit:
cvs rdiff -u -r1.348 -r1.349 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.348 src/usr.bin/make/job.c:1.349
--- src/usr.bin/make/job.c:1.348	Tue Dec  8 20:04:17 2020
+++ src/usr.bin/make/job.c	Tue Dec  8 20:10:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.348 2020/12/08 20:04:17 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.349 2020/12/08 20:10:24 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.348 2020/12/08 20:04:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.349 2020/12/08 20:10:24 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -224,6 +224,12 @@ typedef struct RunFlags {
 	Boolean silent;
 
 	Boolean always;
+
+	/*
+	 * true if we turned error checking off before printing the command
+	 * and need to turn it back on
+	 */
+	Boolean ignerr;
 } RunFlags;
 
 /*
@@ -677,18 +683,18 @@ JobFindPid(int pid, JobStatus status, Bo
 
 /* Parse leading '@', '-' and '+', which control the exact execution mode. */
 static void
-ParseRunOptions(char **pp, RunFlags *out_runFlags, Boolean *out_errOff)
+ParseRunOptions(char **pp, RunFlags *out_runFlags)
 {
 	char *p = *pp;
 	out_runFlags->silent = FALSE;
-	*out_errOff = FALSE;
+	out_runFlags->ignerr = FALSE;
 	out_runFlags->always = FALSE;
 
 	for (;;) {
 		if (*p == '@')
 			out_runFlags->silent = !DEBUG(LOUD);
 		else if (*p == '-')
-			*out_errOff = TRUE;
+			out_runFlags->ignerr = TRUE;
 		else if (*p == '+')
 			out_runFlags->always = TRUE;
 		else
@@ -762,7 +768,7 @@ JobPrintSpecialsErrCtl(Job *job, Boolean
  */
 static void
 JobPrintSpecialsEchoCtl(Job *job, RunFlags *inout_runFlags, const char *escCmd,
-			const char **inout_cmdTemplate, Boolean *out_errOff)
+			const char **inout_cmdTemplate)
 {
 	job->flags |= JOB_IGNERR;
 
@@ -781,25 +787,24 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla
 	 * The error ignoration (hee hee) is already taken care of by the
 	 * errOffOrExecIgnore template, so pretend error checking is still on.
 	 */
-	*out_errOff = FALSE;
+	inout_runFlags->ignerr = FALSE;
 }
 
 static void
 JobPrintSpecials(Job *const job, const char *const escCmd,
 		 Boolean const noSpecials, RunFlags *const inout_runFlags,
-		 const char **const inout_cmdTemplate,
-		 Boolean *const inout_errOff)
+		 const char **const inout_cmdTemplate)
 {
 	if (noSpecials)
-		*inout_errOff = FALSE;
+		inout_runFlags->ignerr = FALSE;
 	else if (commandShell->hasErrCtl)
 		JobPrintSpecialsErrCtl(job, inout_runFlags->silent);
 	else if (commandShell->errOffOrExecIgnore != NULL &&
 		 commandShell->errOffOrExecIgnore[0] != '\0') {
 		JobPrintSpecialsEchoCtl(job, inout_runFlags, escCmd,
-		    inout_cmdTemplate, inout_errOff);
+		    inout_cmdTemplate);
 	} else
-		*inout_errOff = FALSE;
+		inout_runFlags->ignerr = FALSE;
 }
 
 /*
@@ -831,11 +836,6 @@ JobPrintCommand(Job *job, char *cmd)
 	Boolean noSpecials;
 
 	RunFlags runFlags;
-	/*
-	 * true if we turned error checking off before printing the command
-	 * and need to turn it back on
-	 */
-	Boolean errOff;
 	/* Template to use when printing the command */
 	const char *cmdTemplate;
 	char *cmdStart;		/* Start of expanded command */
@@ -851,7 +851,7 @@ JobPrintCommand(Job *job, char *cmd)
 
 	cmdTemplate = "%s\n";
 
-	ParseRunOptions(&cmd, &runFlags, &errOff);
+	ParseRunOptions(&cmd, &runFlags);
 
 	if (runFlags.always && noSpecials) {
 		/*
@@ -882,9 +882,9 @@ JobPrintCommand(Job *job, char *cmd)
 		}
 	}
 
-	if (errOff) {
+	if (runFlags.ignerr) {
 		JobPrintSpecials(job, escCmd, noSpecials, &runFlags,
-		    &cmdTemplate, &errOff);
+		    &cmdTemplate);
 	} else {
 
 		/*
@@ -911,7 +911,7 @@ JobPrintCommand(Job *job, char *cmd)
 				cmdTemplate = commandShell->errOffOrExecIgnore;
 			else
 				cmdTemplate = commandShell->errExit;
-			errOff = FALSE;
+			runFlags.ignerr = FALSE;
 		}
 	}
 
@@ -924,7 +924,7 @@ JobPrintCommand(Job *job, char *cmd)
 	JobPrintf(job, cmdTemplate, cmd);
 	free(cmdStart);
 	free(escCmd);
-	if (errOff) {
+	if (runFlags.ignerr) {
 		/*
 		 * If echoing is already off, there's no point in issuing the
 		 * echoOff command. Otherwise we issue it and pretend it was on

Reply via email to