Module Name: src
Committed By: rillig
Date: Fri Oct 23 18:36:10 UTC 2020
Modified Files:
src/usr.bin/make: arch.c cond.c job.c make.c make.h parse.c suff.c
targ.c
Log Message:
make(1): negate OP_NOP and rename it to GNode_IsTarget
To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/usr.bin/make/arch.c
cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/cond.c
cvs rdiff -u -r1.276 -r1.277 src/usr.bin/make/job.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/make/make.c
cvs rdiff -u -r1.163 -r1.164 src/usr.bin/make/make.h
cvs rdiff -u -r1.396 -r1.397 src/usr.bin/make/parse.c
cvs rdiff -u -r1.217 -r1.218 src/usr.bin/make/suff.c
cvs rdiff -u -r1.120 -r1.121 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/arch.c
diff -u src/usr.bin/make/arch.c:1.138 src/usr.bin/make/arch.c:1.139
--- src/usr.bin/make/arch.c:1.138 Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/arch.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $ */
+/* $NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
#include "config.h"
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: arch.c,v 1.138 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.139 2020/10/23 18:36:09 rillig Exp $");
#ifdef TARGET_MACHINE
#undef MAKE_MACHINE
@@ -1086,7 +1086,7 @@ Arch_LibOODate(GNode *gn)
if (gn->type & OP_PHONY) {
oodate = TRUE;
- } else if (OP_NOP(gn->type) && Lst_IsEmpty(gn->children)) {
+ } else if (!GNode_IsTarget(gn) && Lst_IsEmpty(gn->children)) {
oodate = FALSE;
} else if ((!Lst_IsEmpty(gn->children) && gn->cmgn == NULL) ||
(gn->mtime > now) ||
Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.166 src/usr.bin/make/cond.c:1.167
--- src/usr.bin/make/cond.c:1.166 Fri Oct 23 06:57:41 2020
+++ src/usr.bin/make/cond.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.166 2020/10/23 06:57:41 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.166 2020/10/23 06:57:41 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.167 2020/10/23 18:36:09 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -323,7 +323,7 @@ static Boolean
FuncTarget(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
{
GNode *gn = Targ_FindNode(arg);
- return gn != NULL && !OP_NOP(gn->type);
+ return gn != NULL && GNode_IsTarget(gn);
}
/* See if the given node exists and is an actual target with commands
@@ -332,7 +332,7 @@ static Boolean
FuncCommands(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
{
GNode *gn = Targ_FindNode(arg);
- return gn != NULL && !OP_NOP(gn->type) && !Lst_IsEmpty(gn->commands);
+ return gn != NULL && GNode_IsTarget(gn) && !Lst_IsEmpty(gn->commands);
}
/*-
Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.276 src/usr.bin/make/job.c:1.277
--- src/usr.bin/make/job.c:1.276 Fri Oct 23 17:05:40 2020
+++ src/usr.bin/make/job.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.276 2020/10/23 17:05:40 rillig Exp $ */
+/* $NetBSD: job.c,v 1.277 2020/10/23 18:36:09 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.276 2020/10/23 17:05:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.277 2020/10/23 18:36:09 rillig Exp $");
# define STATIC static
@@ -1179,7 +1179,7 @@ Job_Touch(GNode *gn, Boolean silent)
Boolean
Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
{
- if (OP_NOP(gn->type) && Lst_IsEmpty(gn->commands) &&
+ if (!GNode_IsTarget(gn) && Lst_IsEmpty(gn->commands) &&
((gn->type & OP_LIB) == 0 || Lst_IsEmpty(gn->children))) {
/*
* No commands. Look for .DEFAULT rule from which we might infer
Index: src/usr.bin/make/make.c
diff -u src/usr.bin/make/make.c:1.176 src/usr.bin/make/make.c:1.177
--- src/usr.bin/make/make.c:1.176 Fri Oct 23 04:58:33 2020
+++ src/usr.bin/make/make.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.176 2020/10/23 04:58:33 rillig Exp $ */
+/* $NetBSD: make.c,v 1.177 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.176 2020/10/23 04:58:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.177 2020/10/23 18:36:09 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked = 1;
@@ -225,8 +225,8 @@ Make_OODate(GNode *gn)
/*
* A target is remade in one of the following circumstances:
- * its modification time is smaller than that of its youngest child
- * and it would actually be run (has commands or type OP_NOP)
+ * its modification time is smaller than that of its youngest child and
+ * it would actually be run (has commands or is not GNode_IsTarget)
* it's the object of a force operator
* it has no children, was on the lhs of an operator and doesn't exist
* already.
@@ -324,7 +324,7 @@ Make_OODate(GNode *gn)
/*
* If the target isn't out-of-date, the parents need to know its
* modification time. Note that targets that appear to be out-of-date
- * but aren't, because they have no commands and aren't of type OP_NOP,
+ * but aren't, because they have no commands and are GNode_IsTarget,
* have their mtime stay below their children's mtime to keep parents from
* thinking they're out-of-date.
*/
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.163 src/usr.bin/make/make.h:1.164
--- src/usr.bin/make/make.h:1.163 Fri Oct 23 18:10:39 2020
+++ src/usr.bin/make/make.h Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.163 2020/10/23 18:10:39 rillig Exp $ */
+/* $NetBSD: make.h,v 1.164 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -198,6 +198,7 @@ typedef enum GNodeType {
/* Execution of commands depends on children per line (::) */
OP_DOUBLEDEP = 1 << 2,
+ /* Matches the dependency operators ':', '!' and '::'. */
OP_OPMASK = OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP,
/* Don't care if the target doesn't exist and can't be created */
@@ -574,14 +575,11 @@ int str2Lst_Append(StringList *, char *,
void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
Boolean NoExecute(GNode *gn);
-/*
- * See if the node with the given type was never seen on the left-hand side
- * of a dependency operator, though it may have been on the right-hand side.
- */
+/* See if the node was seen on the left-hand side of a dependency operator. */
static Boolean MAKE_ATTR_UNUSED
-OP_NOP(GNodeType t)
+GNode_IsTarget(const GNode *gn)
{
- return !(t & OP_OPMASK);
+ return (gn->type & OP_OPMASK) != 0;
}
#ifdef __GNUC__
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.396 src/usr.bin/make/parse.c:1.397
--- src/usr.bin/make/parse.c:1.396 Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/parse.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.396 2020/10/22 05:50:02 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.396 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.397 2020/10/23 18:36:09 rillig Exp $");
/* types and constants */
@@ -792,12 +792,11 @@ static Boolean
TryApplyDependencyOperator(GNode *gn, GNodeType op)
{
/*
- * If the dependency mask of the operator and the node don't match and
- * the node has actually had an operator applied to it before, and
- * the operator actually has some dependency information in it, complain.
+ * If the node occurred on the left-hand side of a dependency and the
+ * operator also defines a dependency, they must match.
*/
- if (((op & OP_OPMASK) != (gn->type & OP_OPMASK)) &&
- !OP_NOP(gn->type) && !OP_NOP(op))
+ if ((op & OP_OPMASK) && (gn->type & OP_OPMASK) &&
+ ((op & OP_OPMASK) != (gn->type & OP_OPMASK)))
{
Parse_Error(PARSE_FATAL, "Inconsistent operator for %s", gn->name);
return FALSE;
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.217 src/usr.bin/make/suff.c:1.218
--- src/usr.bin/make/suff.c:1.217 Thu Oct 22 21:27:24 2020
+++ src/usr.bin/make/suff.c Fri Oct 23 18:36:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.217 2020/10/22 21:27:24 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.218 2020/10/23 18:36:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.217 2020/10/22 21:27:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.218 2020/10/23 18:36:09 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1568,7 +1568,7 @@ SuffFindArchiveDeps(GNode *gn, SrcList *
* the user needn't provide a transformation from the member to the
* archive.
*/
- if (OP_NOP(gn->type)) {
+ if (!GNode_IsTarget(gn)) {
gn->type |= OP_DEPENDS;
}
Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.120 src/usr.bin/make/targ.c:1.121
--- src/usr.bin/make/targ.c:1.120 Thu Oct 22 05:50:02 2020
+++ src/usr.bin/make/targ.c Fri Oct 23 18:36:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.120 2020/10/22 05:50:02 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.121 2020/10/23 18:36:10 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.120 2020/10/22 05:50:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.121 2020/10/23 18:36:10 rillig Exp $");
static GNodeList *allTargets; /* the list of all targets found so far */
#ifdef CLEANUP
@@ -453,7 +453,7 @@ Targ_PrintNode(GNode *gn, int pass)
if (gn->flags == 0)
return;
- if (!OP_NOP(gn->type)) {
+ if (GNode_IsTarget(gn)) {
debug_printf("#\n");
if (gn == mainTarg) {
debug_printf("# *** MAIN TARGET ***\n");
@@ -513,7 +513,7 @@ PrintOnlySources(void)
for (ln = allTargets->first; ln != NULL; ln = ln->next) {
GNode *gn = ln->datum;
- if (!OP_NOP(gn->type))
+ if (GNode_IsTarget(gn))
continue;
debug_printf("#\t%s [%s]",