Module Name:    src
Committed By:   rillig
Date:           Fri Jan  7 19:24:27 UTC 2022

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

Log Message:
make: rename and inline Targ_Precious

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/usr.bin/make/compat.c
cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/job.c
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/make.h
cvs rdiff -u -r1.229 -r1.230 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.173 -r1.174 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.235 src/usr.bin/make/compat.c:1.236
--- src/usr.bin/make/compat.c:1.235	Mon Dec 27 18:26:22 2021
+++ src/usr.bin/make/compat.c	Fri Jan  7 19:24:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.235 2021/12/27 18:26:22 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.236 2022/01/07 19:24:27 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.235 2021/12/27 18:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.236 2022/01/07 19:24:27 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -109,7 +109,7 @@ static int compatSigno;
 static void
 CompatDeleteTarget(GNode *gn)
 {
-	if (gn != NULL && !Targ_Precious(gn)) {
+	if (gn != NULL && !GNode_IsPrecious(gn)) {
 		const char *file = GNode_VarTarget(gn);
 
 		if (!opts.noExecute && unlink_file(file)) {
@@ -132,7 +132,7 @@ CompatInterrupt(int signo)
 {
 	CompatDeleteTarget(curTarg);
 
-	if (curTarg != NULL && !Targ_Precious(curTarg)) {
+	if (curTarg != NULL && !GNode_IsPrecious(curTarg)) {
 		/*
 		 * Run .INTERRUPT only if hit with interrupt signal
 		 */

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.446 src/usr.bin/make/job.c:1.447
--- src/usr.bin/make/job.c:1.446	Fri Jan  7 08:28:06 2022
+++ src/usr.bin/make/job.c	Fri Jan  7 19:24:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.446 2022/01/07 08:28:06 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.447 2022/01/07 19:24:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.446 2022/01/07 08:28:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.447 2022/01/07 19:24:27 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -506,7 +506,7 @@ JobDeleteTarget(GNode *gn)
 		return;
 	if (gn->type & OP_PHONY)
 		return;
-	if (Targ_Precious(gn))
+	if (GNode_IsPrecious(gn))
 		return;
 	if (opts.noExecute)
 		return;

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.285 src/usr.bin/make/make.h:1.286
--- src/usr.bin/make/make.h:1.285	Fri Jan  7 13:56:09 2022
+++ src/usr.bin/make/make.h	Fri Jan  7 19:24:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.285 2022/01/07 13:56:09 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.286 2022/01/07 19:24:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -820,6 +820,14 @@ GNode_IsMainCandidate(const GNode *gn)
 			    OP_EXEC | OP_TRANSFORM)) == 0;
 }
 
+/* Return whether the target file should be preserved on interrupt. */
+MAKE_INLINE bool MAKE_ATTR_USE
+GNode_IsPrecious(const GNode *gn)
+{
+	/* XXX: Why are '::' targets precious? */
+	return allPrecious || gn->type & (OP_PRECIOUS | OP_DOUBLEDEP);
+}
+
 MAKE_INLINE const char * MAKE_ATTR_USE
 GNode_VarTarget(GNode *gn) { return GNode_ValueDirect(gn, TARGET); }
 MAKE_INLINE const char * MAKE_ATTR_USE

Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.229 src/usr.bin/make/nonints.h:1.230
--- src/usr.bin/make/nonints.h:1.229	Sun Jan  2 01:54:43 2022
+++ src/usr.bin/make/nonints.h	Fri Jan  7 19:24:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nonints.h,v 1.229 2022/01/02 01:54:43 rillig Exp $	*/
+/*	$NetBSD: nonints.h,v 1.230 2022/01/07 19:24:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -183,7 +183,6 @@ GNode *Targ_GetNode(const char *) MAKE_A
 GNode *Targ_NewInternalNode(const char *) MAKE_ATTR_USE;
 GNode *Targ_GetEndNode(void);
 void Targ_FindList(GNodeList *, StringList *);
-bool Targ_Precious(const GNode *) MAKE_ATTR_USE;
 void Targ_SetMain(GNode *);
 void Targ_PrintCmds(GNode *);
 void Targ_PrintNode(GNode *, int);

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.173 src/usr.bin/make/targ.c:1.174
--- src/usr.bin/make/targ.c:1.173	Sun Nov 28 19:51:06 2021
+++ src/usr.bin/make/targ.c	Fri Jan  7 19:24:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.173 2021/11/28 19:51:06 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.174 2022/01/07 19:24:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -93,9 +93,6 @@
  *	Targ_FindList	Given a list of names, find nodes for all
  *			of them, creating them as necessary.
  *
- *	Targ_Precious	Return true if the target is precious and
- *			should not be removed if we are interrupted.
- *
  *	Targ_Propagate	Propagate information between related nodes.
  *			Should be called after the makefiles are parsed
  *			but before any action is taken.
@@ -113,7 +110,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.173 2021/11/28 19:51:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.174 2022/01/07 19:24:27 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -346,14 +343,6 @@ Targ_FindList(GNodeList *gns, StringList
 	}
 }
 
-/* See if the given target is precious. */
-bool
-Targ_Precious(const GNode *gn)
-{
-	/* XXX: Why are '::' targets precious? */
-	return allPrecious || gn->type & (OP_PRECIOUS | OP_DOUBLEDEP);
-}
-
 /*
  * The main target to be made; only for debugging output.
  * See mainNode in parse.c for the definitive source.

Reply via email to