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: merge duplicate variables for the main ta...



details:   https://anonhg.NetBSD.org/src/rev/cdd82df7e81a
branches:  trunk
changeset: 359492:cdd82df7e81a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 07 20:50:35 2022 +0000

description:
make: merge duplicate variables for the main target

No functional change.

diffstat:

 usr.bin/make/make.h    |   3 ++-
 usr.bin/make/nonints.h |   3 +--
 usr.bin/make/parse.c   |  11 +++++------
 usr.bin/make/suff.c    |   6 ++----
 usr.bin/make/targ.c    |  19 +++----------------
 5 files changed, 13 insertions(+), 29 deletions(-)

diffs (155 lines):

diff -r 4df547abd66e -r cdd82df7e81a usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Jan 07 20:37:25 2022 +0000
+++ b/usr.bin/make/make.h       Fri Jan 07 20:50:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.286 2022/01/07 19:24:27 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.287 2022/01/07 20:50:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -589,6 +589,7 @@
 extern char *makeDependfile;
 /* If we replaced environ, this will be non-NULL. */
 extern char **savedEnv;
+extern GNode *mainNode;
 
 extern pid_t myPid;
 
diff -r 4df547abd66e -r cdd82df7e81a usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Fri Jan 07 20:37:25 2022 +0000
+++ b/usr.bin/make/nonints.h    Fri Jan 07 20:50:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.231 2022/01/07 20:09:58 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.232 2022/01/07 20:50:35 rillig Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -183,7 +183,6 @@
 GNode *Targ_NewInternalNode(const char *) MAKE_ATTR_USE;
 GNode *Targ_GetEndNode(void);
 void Targ_FindList(GNodeList *, StringList *);
-void Targ_SetMain(GNode *);
 void Targ_PrintCmds(GNode *);
 void Targ_PrintNode(GNode *, int);
 void Targ_PrintNodes(GNodeList *, int);
diff -r 4df547abd66e -r cdd82df7e81a usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Jan 07 20:37:25 2022 +0000
+++ b/usr.bin/make/parse.c      Fri Jan 07 20:50:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.630 2022/01/07 20:37:25 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.630 2022/01/07 20:37:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $");
 
 /*
  * A file being read.
@@ -179,10 +179,10 @@
 typedef ListNode SearchPathListNode;
 
 /*
- * The main target to create. This is the first target defined in any of the
- * makefiles.
+ * The target to be made if no targets are specified in the command line.
+ * This is the first target defined in any of the makefiles.
  */
-static GNode *mainNode;
+GNode *mainNode;
 
 /*
  * During parsing, the targets from the left-hand side of the currently
@@ -829,7 +829,6 @@
                if (GNode_IsMainCandidate(gn)) {
                        DEBUG1(MAKE, "Setting main node to \"%s\"\n", gn->name);
                        mainNode = gn;
-                       Targ_SetMain(gn);
                        return;
                }
        }
diff -r 4df547abd66e -r cdd82df7e81a usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Fri Jan 07 20:37:25 2022 +0000
+++ b/usr.bin/make/suff.c       Fri Jan 07 20:50:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.362 2022/01/01 19:44:05 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.362 2022/01/01 19:44:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $");
 
 typedef List SuffixList;
 typedef ListNode SuffixListNode;
@@ -744,7 +744,6 @@
            GNode_IsMainCandidate(target)) {
                DEBUG1(MAKE, "Setting main node to \"%s\"\n", target->name);
                *inout_main = target;
-               Targ_SetMain(target);
                /*
                 * XXX: Why could it be a good idea to return true here?
                 * The main task of this function is to turn ordinary nodes
@@ -788,7 +787,6 @@
                            target->name);
                        *inout_removedMain = true;
                        *inout_main = NULL;
-                       Targ_SetMain(NULL);
                }
                Lst_Done(&target->children);
                Lst_Init(&target->children);
diff -r 4df547abd66e -r cdd82df7e81a usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Fri Jan 07 20:37:25 2022 +0000
+++ b/usr.bin/make/targ.c       Fri Jan 07 20:50:35 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.175 2022/01/07 20:37:25 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.176 2022/01/07 20:50:35 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.175 2022/01/07 20:37:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.176 2022/01/07 20:50:35 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -340,19 +340,6 @@
        }
 }
 
-/*
- * The main target to be made; only for debugging output.
- * See mainNode in parse.c for the definitive source.
- */
-static GNode *mainTarg;
-
-/* Remember the main target to make; only used for debugging. */
-void
-Targ_SetMain(GNode *gn)
-{
-       mainTarg = gn;
-}
-
 static void
 PrintNodeNames(GNodeList *gnodes)
 {
@@ -494,7 +481,7 @@
                return;
 
        debug_printf("#\n");
-       if (gn == mainTarg)
+       if (gn == mainNode)
                debug_printf("# *** MAIN TARGET ***\n");
 
        if (pass >= 2) {



Home | Main Index | Thread Index | Old Index