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): rename DEFAULT to defaultNode



details:   https://anonhg.NetBSD.org/src/rev/9baf4e5b07fe
branches:  trunk
changeset: 942667:9baf4e5b07fe
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 15:58:01 2020 +0000

description:
make(1): rename DEFAULT to defaultNode

In C, uppercase names are typically used for constants, and this is not
a constant.

diffstat:

 usr.bin/make/job.c   |  19 +++++++++----------
 usr.bin/make/main.c  |   8 ++++----
 usr.bin/make/make.h  |   4 ++--
 usr.bin/make/parse.c |   8 ++++----
 4 files changed, 19 insertions(+), 20 deletions(-)

diffs (136 lines):

diff -r 7026693091cc -r 9baf4e5b07fe usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Nov 14 15:47:35 2020 +0000
+++ b/usr.bin/make/job.c        Sat Nov 14 15:58:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.322 2020/11/14 15:47:35 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.323 2020/11/14 15:58:01 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.322 2020/11/14 15:47:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.323 2020/11/14 15:58:01 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1182,20 +1182,19 @@
 
     /*
      * No commands. Look for .DEFAULT rule from which we might infer
-     * commands
+     * commands.
      */
-    if (DEFAULT != NULL && !Lst_IsEmpty(DEFAULT->commands) &&
+    if (defaultNode != NULL && !Lst_IsEmpty(defaultNode->commands) &&
        !(gn->type & OP_SPECIAL)) {
        /*
-        * Make only looks for a .DEFAULT if the node was never the
-        * target of an operator, so that's what we do too. If
-        * a .DEFAULT was given, we substitute its commands for gn's
-        * commands and set the IMPSRC variable to be the target's name
-        * The DEFAULT node acts like a transformation rule, in that
+        * The traditional Make only looks for a .DEFAULT if the node was
+        * never the target of an operator, so that's what we do too.
+        *
+        * The .DEFAULT node acts like a transformation rule, in that
         * gn also inherits any attributes or sources attached to
         * .DEFAULT itself.
         */
-       Make_HandleUse(DEFAULT, gn);
+       Make_HandleUse(defaultNode, gn);
        Var_Set(IMPSRC, GNode_VarTarget(gn), gn);
        return TRUE;
     }
diff -r 7026693091cc -r 9baf4e5b07fe usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 14 15:47:35 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 14 15:58:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.458 2020/11/13 19:45:24 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.458 2020/11/13 19:45:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.459 2020/11/14 15:58:01 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -122,7 +122,7 @@
 
 CmdOpts opts;
 time_t now;                    /* Time at start of make */
-GNode *DEFAULT;                        /* .DEFAULT node */
+GNode *defaultNode;            /* .DEFAULT node */
 Boolean allPrecious;           /* .PRECIOUS given on line by itself */
 Boolean deleteOnError;         /* .DELETE_ON_ERROR: set */
 
@@ -1504,7 +1504,7 @@
        Suff_Init();
        Trace_Init(tracefile);
 
-       DEFAULT = NULL;
+       defaultNode = NULL;
        (void)time(&now);
 
        Trace_Log(MAKESTART, NULL);
diff -r 7026693091cc -r 9baf4e5b07fe usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Nov 14 15:47:35 2020 +0000
+++ b/usr.bin/make/make.h       Sat Nov 14 15:58:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.206 2020/11/12 23:35:21 sjg Exp $   */
+/*     $NetBSD: make.h,v 1.207 2020/11/14 15:58:01 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -423,7 +423,7 @@
 /* TRUE while processing .depend */
 extern Boolean doing_depend;
 /* .DEFAULT rule */
-extern GNode *DEFAULT;
+extern GNode *defaultNode;
 
 /* Variables defined internally by make which should not override those set
  * by makefiles. */
diff -r 7026693091cc -r 9baf4e5b07fe usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Nov 14 15:47:35 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Nov 14 15:58:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.438 2020/11/12 23:35:21 sjg Exp $  */
+/*     $NetBSD: parse.c,v 1.439 2020/11/14 15:58:01 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.438 2020/11/12 23:35:21 sjg Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.439 2020/11/14 15:58:01 rillig Exp $");
 
 /* types and constants */
 
@@ -1088,7 +1088,7 @@
  *                     it to be the Main Target, so we
  *                     create it, set OP_NOTMAIN and
  *                     add it to the list, setting
- *                     DEFAULT to the new node for
+ *                     defaultNode to the new node for
  *                     later use. We claim the node is
  *                     A transformation rule to make
  *                     life easier later, when we'll
@@ -1138,7 +1138,7 @@
        GNode *gn = Targ_NewGN(".DEFAULT");
        gn->type |= OP_NOTMAIN|OP_TRANSFORM;
        Lst_Append(targets, gn);
-       DEFAULT = gn;
+       defaultNode = gn;
        break;
     }
     case SP_DELETE_ON_ERROR:



Home | Main Index | Thread Index | Old Index