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): extract ParseDependencySourceWait



details:   https://anonhg.NetBSD.org/src/rev/1fc8dc4c9920
branches:  trunk
changeset: 946662:1fc8dc4c9920
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 05 19:03:45 2020 +0000

description:
make(1): extract ParseDependencySourceWait

diffstat:

 usr.bin/make/parse.c |  48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diffs (79 lines):

diff -r 5ebd61740148 -r 1fc8dc4c9920 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sat Dec 05 18:57:21 2020 +0000
+++ b/usr.bin/make/parse.c      Sat Dec 05 19:03:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.466 2020/12/05 18:38:02 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.467 2020/12/05 19:03:45 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.466 2020/12/05 18:38:02 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.467 2020/12/05 19:03:45 rillig Exp $");
 
 /* types and constants */
 
@@ -855,12 +855,33 @@
            break;
 }
 
+/*
+ * We add a .WAIT node in the dependency list. After any dynamic dependencies
+ * (and filename globbing) have happened, it is given a dependency on each
+ * previous child, back until the previous .WAIT node. The next child won't
+ * be scheduled until the .WAIT node is built.
+ *
+ * We give each .WAIT node a unique name (mainly for diagnostics).
+ */
+static void
+ParseDependencySourceWait(Boolean isSpecial)
+{
+       static int wait_number = 0;
+       char wait_src[16];
+       GNode *gn;
+
+       snprintf(wait_src, sizeof wait_src, ".WAIT_%u", ++wait_number);
+       gn = Targ_NewInternalNode(wait_src);
+       if (doing_depend)
+               ParseMark(gn);
+       gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN;
+       LinkToTargets(gn, isSpecial);
+
+}
+
 static Boolean
 ParseDependencySourceKeyword(const char *src, ParseSpecial specType)
 {
-    static int wait_number = 0;
-    char wait_src[16];
-    GNode *gn;
 
     if (*src == '.' && ch_isupper(src[1])) {
        int keywd = ParseFindKeyword(src);
@@ -871,22 +892,7 @@
                return TRUE;
            }
            if (parseKeywords[keywd].spec == SP_WAIT) {
-               /*
-                * We add a .WAIT node in the dependency list.
-                * After any dynamic dependencies (and filename globbing)
-                * have happened, it is given a dependency on each
-                * previous child, back until the previous .WAIT node.
-                * The next child won't be scheduled until the .WAIT node
-                * is built.
-                * We give each .WAIT node a unique name (mainly for
-                * diagnostics).
-                */
-               snprintf(wait_src, sizeof wait_src, ".WAIT_%u", ++wait_number);
-               gn = Targ_NewInternalNode(wait_src);
-               if (doing_depend)
-                   ParseMark(gn);
-               gn->type = OP_WAIT | OP_PHONY | OP_DEPENDS | OP_NOTMAIN;
-               LinkToTargets(gn, specType != SP_NOT);
+               ParseDependencySourceWait(specType != SP_NOT);
                return TRUE;
            }
        }



Home | Main Index | Thread Index | Old Index