aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/suff.c
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2021-02-11 06:01:59 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2021-02-11 06:03:22 +0000
commitdba7b0ef928af88caa38728a73657b837aeeac93 (patch)
treefd78de6458efc1c445f9de477bfbd0565dcf5f8b /contrib/bmake/suff.c
parent2a7d4d95450429a0d08232a5019a592c47955de3 (diff)
parent8b6f73e37baf5c37946844ec335a84856b1a9033 (diff)
downloadsrc-dba7b0ef928af88caa38728a73657b837aeeac93.tar.gz
src-dba7b0ef928af88caa38728a73657b837aeeac93.zip
Merge bmake-20210206
Changes of interest o unit-tests: use private TMPDIR to avoid errors from other users o avoid strdup in mkTempFile o always use vfork o job.c: do not create empty shell files in jobs mode reduce unnecessary calls to waitpid o cond.c: fix debug output for comparison operators in conditionals
Diffstat (limited to 'contrib/bmake/suff.c')
-rw-r--r--contrib/bmake/suff.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/contrib/bmake/suff.c b/contrib/bmake/suff.c
index db9ad982ecef..91e8bc613eb8 100644
--- a/contrib/bmake/suff.c
+++ b/contrib/bmake/suff.c
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.345 2021/02/05 05:15:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.345 2021/02/05 05:15:12 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -885,7 +885,7 @@ Suff_DoPaths(void)
for (ln = sufflist.first; ln != NULL; ln = ln->next) {
Suffix *suff = ln->datum;
- if (!Lst_IsEmpty(suff->searchPath)) {
+ if (!Lst_IsEmpty(&suff->searchPath->dirs)) {
#ifdef INCLUDES
if (suff->flags & SUFF_INCLUDE)
SearchPath_AddAll(includesPath,
@@ -902,12 +902,12 @@ Suff_DoPaths(void)
}
}
- flags = SearchPath_ToFlags("-I", includesPath);
- Var_Set(".INCLUDES", flags, VAR_GLOBAL);
+ flags = SearchPath_ToFlags(includesPath, "-I");
+ Global_Set(".INCLUDES", flags);
free(flags);
- flags = SearchPath_ToFlags("-L", libsPath);
- Var_Set(".LIBS", flags, VAR_GLOBAL);
+ flags = SearchPath_ToFlags(libsPath, "-L");
+ Global_Set(".LIBS", flags);
free(flags);
SearchPath_Free(includesPath);
@@ -1176,14 +1176,14 @@ FindCmds(Candidate *targ, CandidateSearcher *cs)
GNode *tgn; /* Target GNode */
GNode *sgn; /* Source GNode */
size_t prefLen; /* The length of the defined prefix */
- Suffix *suff; /* Suffix on matching beastie */
+ Suffix *suff; /* Suffix of the matching candidate */
Candidate *ret; /* Return value */
tgn = targ->node;
prefLen = strlen(targ->prefix);
for (gln = tgn->children.first; gln != NULL; gln = gln->next) {
- const char *cp;
+ const char *base;
sgn = gln->datum;
@@ -1198,11 +1198,11 @@ FindCmds(Candidate *targ, CandidateSearcher *cs)
continue;
}
- cp = str_basename(sgn->name);
- if (strncmp(cp, targ->prefix, prefLen) != 0)
+ base = str_basename(sgn->name);
+ if (strncmp(base, targ->prefix, prefLen) != 0)
continue;
/* The node matches the prefix, see if it has a known suffix. */
- suff = FindSuffixByName(cp + prefLen);
+ suff = FindSuffixByName(base + prefLen);
if (suff == NULL)
continue;
@@ -1246,7 +1246,7 @@ ExpandWildcards(GNodeListNode *cln, GNode *pgn)
* Expand the word along the chosen path
*/
Lst_Init(&expansions);
- Dir_Expand(cgn->name, Suff_FindPath(cgn), &expansions);
+ SearchPath_Expand(Suff_FindPath(cgn), cgn->name, &expansions);
while (!Lst_IsEmpty(&expansions)) {
GNode *gn;
@@ -1388,9 +1388,9 @@ ExpandChildren(GNodeListNode *cln, GNode *pgn)
if (cgn->type & OP_ARCHV) {
/*
- * Node was an archive(member) target, so we want to
+ * Node was an 'archive(member)' target, so
* call on the Arch module to find the nodes for us,
- * expanding variables in the parent's context.
+ * expanding variables in the parent's scope.
*/
char *p = cp;
(void)Arch_ParseArchive(&p, &members, pgn);
@@ -1626,8 +1626,8 @@ FindDepsArchive(GNode *gn, CandidateSearcher *cs)
gn->unmade++;
/* Copy in the variables from the member node to this one. */
- Var_Set(PREFIX, GNode_VarPrefix(mem), gn);
- Var_Set(TARGET, GNode_VarTarget(mem), gn);
+ Var_Set(gn, PREFIX, GNode_VarPrefix(mem));
+ Var_Set(gn, TARGET, GNode_VarTarget(mem));
memSuff = mem->suffix;
if (memSuff == NULL) { /* Didn't know what it was. */
@@ -1637,10 +1637,10 @@ FindDepsArchive(GNode *gn, CandidateSearcher *cs)
/* Set the other two local variables required for this target. */
- Var_Set(MEMBER, name, gn);
- Var_Set(ARCHIVE, gn->name, gn);
+ Var_Set(gn, MEMBER, name);
+ Var_Set(gn, ARCHIVE, gn->name);
/* Set $@ for compatibility with other makes. */
- Var_Set(TARGET, gn->name, gn);
+ Var_Set(gn, TARGET, gn->name);
/*
* Now we've got the important local variables set, expand any sources
@@ -1691,7 +1691,7 @@ FindDepsLib(GNode *gn)
Arch_FindLib(gn, suff->searchPath);
} else {
Suffix_Unassign(&gn->suffix);
- Var_Set(TARGET, gn->name, gn);
+ Var_Set(gn, TARGET, gn->name);
}
/*
@@ -1699,7 +1699,7 @@ FindDepsLib(GNode *gn)
* filesystem conventions, we don't set the regular variables for
* the thing. .PREFIX is simply made empty.
*/
- Var_Set(PREFIX, "", gn);
+ Var_Set(gn, PREFIX, "");
}
static void
@@ -1776,7 +1776,7 @@ FindDepsRegularPath(GNode *gn, Candidate *targ)
if (gn->path == NULL)
return;
- Var_Set(TARGET, gn->path, gn);
+ Var_Set(gn, TARGET, gn->path);
if (targ != NULL) {
/*
@@ -1791,7 +1791,7 @@ FindDepsRegularPath(GNode *gn, Candidate *targ)
savec = gn->path[savep];
gn->path[savep] = '\0';
- Var_Set(PREFIX, str_basename(gn->path), gn);
+ Var_Set(gn, PREFIX, str_basename(gn->path));
gn->path[savep] = savec;
} else {
@@ -1800,7 +1800,7 @@ FindDepsRegularPath(GNode *gn, Candidate *targ)
* known suffix.
*/
Suffix_Unassign(&gn->suffix);
- Var_Set(PREFIX, str_basename(gn->path), gn);
+ Var_Set(gn, PREFIX, str_basename(gn->path));
}
}
@@ -1890,8 +1890,8 @@ FindDepsRegular(GNode *gn, CandidateSearcher *cs)
}
}
- Var_Set(TARGET, GNode_Path(gn), gn);
- Var_Set(PREFIX, targ != NULL ? targ->prefix : gn->name, gn);
+ Var_Set(gn, TARGET, GNode_Path(gn));
+ Var_Set(gn, PREFIX, targ != NULL ? targ->prefix : gn->name);
/*
* Now we've got the important local variables set, expand any sources
@@ -1981,8 +1981,8 @@ FindDepsRegular(GNode *gn, CandidateSearcher *cs)
* we need to do is set the standard variables.
*/
targ->node->type |= OP_DEPS_FOUND;
- Var_Set(PREFIX, targ->prefix, targ->node);
- Var_Set(TARGET, targ->node->name, targ->node);
+ Var_Set(targ->node, PREFIX, targ->prefix);
+ Var_Set(targ->node, TARGET, targ->node->name);
}
}
@@ -2048,8 +2048,8 @@ FindDeps(GNode *gn, CandidateSearcher *cs)
gn->type |= OP_DEPS_FOUND;
/* Make sure we have these set, may get revised below. */
- Var_Set(TARGET, GNode_Path(gn), gn);
- Var_Set(PREFIX, gn->name, gn);
+ Var_Set(gn, TARGET, GNode_Path(gn));
+ Var_Set(gn, PREFIX, gn->name);
DEBUG1(SUFF, "SuffFindDeps \"%s\"\n", gn->name);
@@ -2137,9 +2137,7 @@ Suffix_Print(Suffix *suff)
char flags_buf[SuffixFlags_ToStringSize];
debug_printf(" (%s)",
- Enum_FlagsToString(flags_buf, sizeof flags_buf,
- suff->flags,
- SuffixFlags_ToStringSpecs));
+ SuffixFlags_ToString(flags_buf, suff->flags));
}
debug_printf("\n");