Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): negate OP_NOP and rename it to GNode_I...



details:   https://anonhg.NetBSD.org/src/rev/290fda2b09e1
branches:  trunk
changeset: 956180:290fda2b09e1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 23 18:36:09 2020 +0000

description:
make(1): negate OP_NOP and rename it to GNode_IsTarget

diffstat:

 usr.bin/make/arch.c  |   6 +++---
 usr.bin/make/cond.c  |   8 ++++----
 usr.bin/make/job.c   |   6 +++---
 usr.bin/make/make.c  |  10 +++++-----
 usr.bin/make/make.h  |  12 +++++-------
 usr.bin/make/parse.c |  13 ++++++-------
 usr.bin/make/suff.c  |   6 +++---
 usr.bin/make/targ.c  |   8 ++++----
 8 files changed, 33 insertions(+), 36 deletions(-)

diffs (261 lines):

diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/arch.c       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
 
     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) ||
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/cond.c       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
 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 @@
 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);
 }
 
 /*-
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/job.c        Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
 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
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/make.c       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
 
     /*
      * 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 @@
     /*
      * 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.
      */
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/make.h       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
     /* 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 @@
 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__
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/parse.c      Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
 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;
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/suff.c       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
      * 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;
     }
 
diff -r 175d797dff2f -r 290fda2b09e1 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Fri Oct 23 18:10:39 2020 +0000
+++ b/usr.bin/make/targ.c       Fri Oct 23 18:36:09 2020 +0000
@@ -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 @@
     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 @@
 
     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]",



Home | Main Index | Thread Index | Old Index