From 0a92a05758622cc6774cc6d9742220aee6e4cf9a Mon Sep 17 00:00:00 2001
From: Marc Espie <espie@cvs.openbsd.org>
Date: Sat, 3 Nov 2007 14:05:40 +0000
Subject: simplify: Job_CheckCommands deals with silent and ignerr now, so
 there's no need to duplicate that info at the job level since we can just use
 the gn->type.

---
 usr.bin/make/compat.c |  4 ++--
 usr.bin/make/engine.c |  6 +++---
 usr.bin/make/engine.h |  6 +++---
 usr.bin/make/job.c    | 26 +++++++-------------------
 4 files changed, 15 insertions(+), 27 deletions(-)

(limited to 'usr.bin')

diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index 12c8c3bd5a3..8da3df0c660 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,5 +1,5 @@
 /*	$OpenPackages$ */
-/*	$OpenBSD: compat.c,v 1.64 2007/11/03 11:42:41 espie Exp $	*/
+/*	$OpenBSD: compat.c,v 1.65 2007/11/03 14:05:39 espie Exp $	*/
 /*	$NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $	*/
 
 /*
@@ -134,7 +134,7 @@ CompatMake(void *gnp,	/* The node to make */
 			if (!touchFlag)
 				run_gnode(gn, 0);
 			else
-				Job_Touch(gn, gn->type & OP_SILENT);
+				Job_Touch(gn);
 		} else
 			gn->made = ERROR;
 
diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c
index bdb18083521..9bc499edf1e 100644
--- a/usr.bin/make/engine.c
+++ b/usr.bin/make/engine.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: engine.c,v 1.11 2007/11/03 11:42:41 espie Exp $ */
+/*	$OpenBSD: engine.c,v 1.12 2007/11/03 14:05:39 espie Exp $ */
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
  * Copyright (c) 1988, 1989 by Adam de Boor
@@ -158,7 +158,7 @@ rewrite_time(const char *name)
 }
 
 void
-Job_Touch(GNode *gn, bool silent)
+Job_Touch(GNode *gn)
 {
 	if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) {
 		/*
@@ -168,7 +168,7 @@ Job_Touch(GNode *gn, bool silent)
 		return;
 	}
 
-	if (!silent) {
+	if (!(gn->type & OP_SILENT)) {
 		(void)fprintf(stdout, "touch %s\n", gn->name);
 		(void)fflush(stdout);
 	}
diff --git a/usr.bin/make/engine.h b/usr.bin/make/engine.h
index 68fc47aa7a2..ce05ec844d1 100644
--- a/usr.bin/make/engine.h
+++ b/usr.bin/make/engine.h
@@ -1,6 +1,6 @@
 #ifndef ENGINE_H
 #define ENGINE_H
-/*	$OpenBSD: engine.h,v 1.3 2007/11/02 17:27:24 espie Exp $	*/
+/*	$OpenBSD: engine.h,v 1.4 2007/11/03 14:05:39 espie Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -43,11 +43,11 @@
  * 	.DEFAULT and other places if necessary.
  */
 extern bool Job_CheckCommands(GNode *, void (*abortProc)(char *, ...));
-/* Job_Touch(node, besilent);
+/* Job_Touch(node);
  *	touch the path corresponding to a node or update the corresponding
  *	archive object.
  */
-extern void Job_Touch(GNode *, bool);
+extern void Job_Touch(GNode *);
 /* Make_TimeStamp(parent, child);
  *	ensure parent is at least as recent as child.
  */
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index a7384441a0d..3ea510a4936 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,5 +1,5 @@
 /*	$OpenPackages$ */
-/*	$OpenBSD: job.c,v 1.105 2007/11/03 11:44:30 espie Exp $	*/
+/*	$OpenBSD: job.c,v 1.106 2007/11/03 14:05:39 espie Exp $	*/
 /*	$NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $	*/
 
 /*
@@ -152,8 +152,6 @@ typedef struct Job_ {
     pid_t 	pid;	    /* The child's process ID */
     GNode	*node;	    /* The target the child is making */
     short	flags;	    /* Flags to control treatment of job */
-#define JOB_IGNERR	0x001	/* Ignore non-zero exits */
-#define JOB_SILENT	0x002	/* no output */
 #define JOB_SPECIAL	0x004	/* Target is a special one. */
 #define JOB_RESTART	0x080	/* Job needs to be completely restarted */
 #define JOB_RESUME	0x100	/* Job needs to be resumed b/c it stopped,
@@ -490,11 +488,7 @@ JobClose(Job *job)
  *-----------------------------------------------------------------------
  * JobFinish  --
  *	Do final processing for the given job including updating
- *	parents and starting new jobs as available/necessary. Note
- *	that we pay no attention to the JOB_IGNERR flag here.
- *	This is because when we're called because of a noexecute flag
- *	or something, jstat.w_status is 0 and when called from
- *	Job_CatchChildren, the status is zeroed if it s/b ignored.
+ *	parents and starting new jobs as available/necessary. 
  *
  * Side Effects:
  *	Some nodes may be put on the toBeMade queue.
@@ -513,7 +507,7 @@ JobFinish(Job *job, int status)
 	bool	 done;
 
 	if ((WIFEXITED(status) &&
-	     WEXITSTATUS(status) != 0 && !(job->flags & JOB_IGNERR)) ||
+	     WEXITSTATUS(status) != 0 && !(job->node->type & OP_IGNORE)) ||
 	    (WIFSIGNALED(status) && WTERMSIG(status) != SIGCONT)) {
 		/*
 		 * If it exited non-zero and either we're doing things our
@@ -557,10 +551,10 @@ JobFinish(Job *job, int status)
 				banner(job, stdout);
 				(void)fprintf(stdout, "*** Error code %d%s\n",
 				    WEXITSTATUS(status),
-				    (job->flags & JOB_IGNERR) ? "(ignored)" :
-				    "");
+				    (job->node->type & OP_IGNORE) ? 
+				    "(ignored)" : "");
 
-				if (job->flags & JOB_IGNERR) {
+				if (job->node->type & OP_IGNORE) {
 					status = 0;
 				}
 			} else if (DEBUG(JOB)) {
@@ -907,12 +901,6 @@ prepare_job(GNode *gn, int flags)
 	 * are also added to the field.
 	 */
 	job->flags = flags;
-	if (Targ_Ignore(gn)) {
-		job->flags |= JOB_IGNERR;
-	}
-	if (Targ_Silent(gn)) {
-		job->flags |= JOB_SILENT;
-	}
 
 	/*
 	 * Check the commands now so any attributes from .DEFAULT have a chance
@@ -946,7 +934,7 @@ prepare_job(GNode *gn, int flags)
 		 * the commands, too, but don't die if they're no good -- it
 		 * does no harm to keep working up the graph.
 		 */
-		Job_Touch(gn, job->flags & JOB_SILENT);
+		Job_Touch(gn);
 		noExec = true;
 	}
 
-- 
cgit v1.2.3