Module Name: src
Committed By: rillig
Date: Thu Jan 21 14:30:01 UTC 2021
Modified Files:
src/usr.bin/make: make.h parse.c
Log Message:
make(1): merge duplicate code in Parse_MainName
To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/usr.bin/make/make.h
cvs rdiff -u -r1.526 -r1.527 src/usr.bin/make/parse.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/make.h
diff -u src/usr.bin/make/make.h:1.244 src/usr.bin/make/make.h:1.245
--- src/usr.bin/make/make.h:1.244 Tue Jan 19 20:51:46 2021
+++ src/usr.bin/make/make.h Thu Jan 21 14:30:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.244 2021/01/19 20:51:46 rillig Exp $ */
+/* $NetBSD: make.h,v 1.245 2021/01/21 14:30:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -413,7 +413,10 @@ typedef struct GNode {
* this node, in the normal sense. */
GNodeList order_succ;
- /* Other nodes of the same name, for the '::' dependency operator. */
+ /*
+ * Other nodes of the same name, for targets that were defined using
+ * the '::' dependency operator (OP_DOUBLEDEP).
+ */
GNodeList cohorts;
/* The "#n" suffix for this cohort, or "" for other nodes */
char cohort_num[8];
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.526 src/usr.bin/make/parse.c:1.527
--- src/usr.bin/make/parse.c:1.526 Sun Jan 10 21:20:46 2021
+++ src/usr.bin/make/parse.c Thu Jan 21 14:30:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.526 2021/01/10 21:20:46 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.527 2021/01/21 14:30:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.526 2021/01/10 21:20:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.527 2021/01/21 14:30:01 rillig Exp $");
/* types and constants */
@@ -3259,11 +3259,9 @@ Parse_MainName(GNodeList *mainList)
if (mainNode == NULL)
Punt("no target to make.");
- if (mainNode->type & OP_DOUBLEDEP) {
- Lst_Append(mainList, mainNode);
+ Lst_Append(mainList, mainNode);
+ if (mainNode->type & OP_DOUBLEDEP)
Lst_AppendAll(mainList, &mainNode->cohorts);
- } else
- Lst_Append(mainList, mainNode);
Var_Append(".TARGETS", mainNode->name, VAR_GLOBAL);
}