Module Name:    src
Committed By:   rillig
Date:           Sat Dec 12 00:05:05 UTC 2020

Modified Files:
        src/usr.bin/make: compat.c job.c nonints.h targ.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/usr.bin/make/compat.c
cvs rdiff -u -r1.368 -r1.369 src/usr.bin/make/job.c
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.154 -r1.155 src/usr.bin/make/targ.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/compat.c
diff -u src/usr.bin/make/compat.c:1.205 src/usr.bin/make/compat.c:1.206
--- src/usr.bin/make/compat.c:1.205	Thu Dec 10 20:49:11 2020
+++ src/usr.bin/make/compat.c	Sat Dec 12 00:05:05 2020
@@ -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
 	 * 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)) {

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.368 src/usr.bin/make/job.c:1.369
--- src/usr.bin/make/job.c:1.368	Fri Dec 11 22:33:06 2020
+++ src/usr.bin/make/job.c	Sat Dec 12 00:05:05 2020
@@ -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, Bool
 #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;
 
 	/*

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.165 src/usr.bin/make/nonints.h:1.166
--- src/usr.bin/make/nonints.h:1.165	Sun Dec  6 20:09:01 2020
+++ src/usr.bin/make/nonints.h	Sat Dec 12 00:05:05 2020
@@ -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 *);

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.154 src/usr.bin/make/targ.c:1.155
--- src/usr.bin/make/targ.c:1.154	Mon Dec  7 23:59:59 2020
+++ src/usr.bin/make/targ.c	Sat Dec 12 00:05:05 2020
@@ -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
 	}
 }
 
-/*
- * 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)

Reply via email to