make: replace Global_AppendExpand with Global_Append

All callers with a variable name that is guaranteed to not contain a
dollar sign have been converted to call Global_Append instead of the
previous Global_AppendExpand.  After that, Global_AppendExpand was
unused, therefore it was effectively just renamed.
This commit is contained in:
rillig 2021-02-03 13:53:12 +00:00
parent 8c8241ebce
commit a1bc5ad8cf
8 changed files with 69 additions and 69 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.266 2021/02/03 08:00:36 rillig Exp $ */
/* $NetBSD: dir.c,v 1.267 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -138,7 +138,7 @@
#include "job.h"
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
MAKE_RCSID("$NetBSD: dir.c,v 1.266 2021/02/03 08:00:36 rillig Exp $");
MAKE_RCSID("$NetBSD: dir.c,v 1.267 2021/02/03 13:53:12 rillig Exp $");
/*
* A search path is a list of CachedDir structures. A CachedDir has in it the
@ -555,15 +555,15 @@ Dir_SetPATH(void)
CachedDir *dir = ln->datum;
if (dir == dotLast) {
seenDotLast = TRUE;
Global_AppendExpand(".PATH", dotLast->name);
Global_Append(".PATH", dotLast->name);
}
}
if (!seenDotLast) {
if (dot != NULL)
Global_AppendExpand(".PATH", dot->name);
Global_Append(".PATH", dot->name);
if (cur != NULL)
Global_AppendExpand(".PATH", cur->name);
Global_Append(".PATH", cur->name);
}
for (ln = dirSearchPath.dirs.first; ln != NULL; ln = ln->next) {
@ -572,14 +572,14 @@ Dir_SetPATH(void)
continue;
if (dir == dot && seenDotLast)
continue;
Global_AppendExpand(".PATH", dir->name);
Global_Append(".PATH", dir->name);
}
if (seenDotLast) {
if (dot != NULL)
Global_AppendExpand(".PATH", dot->name);
Global_Append(".PATH", dot->name);
if (cur != NULL)
Global_AppendExpand(".PATH", cur->name);
Global_Append(".PATH", cur->name);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.414 2021/02/03 08:08:18 rillig Exp $ */
/* $NetBSD: job.c,v 1.415 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -142,7 +142,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: job.c,v 1.414 2021/02/03 08:08:18 rillig Exp $");
MAKE_RCSID("$NetBSD: job.c,v 1.415 2021/02/03 13:53:12 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@ -2791,8 +2791,8 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
snprintf(jobarg, sizeof jobarg, "%d,%d",
tokenWaitJob.inPipe, tokenWaitJob.outPipe);
Global_AppendExpand(MAKEFLAGS, "-J");
Global_AppendExpand(MAKEFLAGS, jobarg);
Global_Append(MAKEFLAGS, "-J");
Global_Append(MAKEFLAGS, jobarg);
/*
* Preload the job pipe with one token per job, save the one

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.528 2021/02/03 08:08:18 rillig Exp $ */
/* $NetBSD: main.c,v 1.529 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -111,7 +111,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: main.c,v 1.528 2021/02/03 08:08:18 rillig Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.529 2021/02/03 13:53:12 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -409,8 +409,8 @@ MainParseArgJobsInternal(const char *argvalue)
jp_1 = -1;
opts.compatMake = TRUE;
} else {
Global_AppendExpand(MAKEFLAGS, "-J");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-J");
Global_Append(MAKEFLAGS, argvalue);
}
}
@ -427,8 +427,8 @@ MainParseArgJobs(const char *argvalue)
progname);
exit(2); /* Not 1 so -q can distinguish error */
}
Global_AppendExpand(MAKEFLAGS, "-j");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-j");
Global_Append(MAKEFLAGS, argvalue);
Global_Set(".MAKE.JOBS", argvalue);
maxJobTokens = opts.maxJobs;
}
@ -446,8 +446,8 @@ MainParseArgSysInc(const char *argvalue)
} else {
(void)SearchPath_Add(sysIncPath, argvalue);
}
Global_AppendExpand(MAKEFLAGS, "-m");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-m");
Global_Append(MAKEFLAGS, argvalue);
}
static Boolean
@ -458,7 +458,7 @@ MainParseArg(char c, const char *argvalue)
break;
case 'B':
opts.compatMake = TRUE;
Global_AppendExpand(MAKEFLAGS, "-B");
Global_Append(MAKEFLAGS, "-B");
Global_Set(MAKE_MODE, "compat");
break;
case 'C':
@ -467,13 +467,13 @@ MainParseArg(char c, const char *argvalue)
case 'D':
if (argvalue[0] == '\0') return FALSE;
Global_SetExpand(argvalue, "1");
Global_AppendExpand(MAKEFLAGS, "-D");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-D");
Global_Append(MAKEFLAGS, argvalue);
break;
case 'I':
Parse_AddIncludeDir(argvalue);
Global_AppendExpand(MAKEFLAGS, "-I");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-I");
Global_Append(MAKEFLAGS, argvalue);
break;
case 'J':
MainParseArgJobsInternal(argvalue);
@ -481,24 +481,24 @@ MainParseArg(char c, const char *argvalue)
case 'N':
opts.noExecute = TRUE;
opts.noRecursiveExecute = TRUE;
Global_AppendExpand(MAKEFLAGS, "-N");
Global_Append(MAKEFLAGS, "-N");
break;
case 'S':
opts.keepgoing = FALSE;
Global_AppendExpand(MAKEFLAGS, "-S");
Global_Append(MAKEFLAGS, "-S");
break;
case 'T':
tracefile = bmake_strdup(argvalue);
Global_AppendExpand(MAKEFLAGS, "-T");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-T");
Global_Append(MAKEFLAGS, argvalue);
break;
case 'V':
case 'v':
opts.printVars = c == 'v' ? PVM_EXPANDED : PVM_UNEXPANDED;
Lst_Append(&opts.variables, bmake_strdup(argvalue));
/* XXX: Why always -V? */
Global_AppendExpand(MAKEFLAGS, "-V");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-V");
Global_Append(MAKEFLAGS, argvalue);
break;
case 'W':
opts.parseWarnFatal = TRUE;
@ -506,35 +506,35 @@ MainParseArg(char c, const char *argvalue)
break;
case 'X':
opts.varNoExportEnv = TRUE;
Global_AppendExpand(MAKEFLAGS, "-X");
Global_Append(MAKEFLAGS, "-X");
break;
case 'd':
/* If '-d-opts' don't pass to children */
if (argvalue[0] == '-')
argvalue++;
else {
Global_AppendExpand(MAKEFLAGS, "-d");
Global_AppendExpand(MAKEFLAGS, argvalue);
Global_Append(MAKEFLAGS, "-d");
Global_Append(MAKEFLAGS, argvalue);
}
MainParseArgDebug(argvalue);
break;
case 'e':
opts.checkEnvFirst = TRUE;
Global_AppendExpand(MAKEFLAGS, "-e");
Global_Append(MAKEFLAGS, "-e");
break;
case 'f':
Lst_Append(&opts.makefiles, bmake_strdup(argvalue));
break;
case 'i':
opts.ignoreErrors = TRUE;
Global_AppendExpand(MAKEFLAGS, "-i");
Global_Append(MAKEFLAGS, "-i");
break;
case 'j':
MainParseArgJobs(argvalue);
break;
case 'k':
opts.keepgoing = TRUE;
Global_AppendExpand(MAKEFLAGS, "-k");
Global_Append(MAKEFLAGS, "-k");
break;
case 'm':
MainParseArgSysInc(argvalue);
@ -542,28 +542,28 @@ MainParseArg(char c, const char *argvalue)
break;
case 'n':
opts.noExecute = TRUE;
Global_AppendExpand(MAKEFLAGS, "-n");
Global_Append(MAKEFLAGS, "-n");
break;
case 'q':
opts.queryFlag = TRUE;
/* Kind of nonsensical, wot? */
Global_AppendExpand(MAKEFLAGS, "-q");
Global_Append(MAKEFLAGS, "-q");
break;
case 'r':
opts.noBuiltins = TRUE;
Global_AppendExpand(MAKEFLAGS, "-r");
Global_Append(MAKEFLAGS, "-r");
break;
case 's':
opts.beSilent = TRUE;
Global_AppendExpand(MAKEFLAGS, "-s");
Global_Append(MAKEFLAGS, "-s");
break;
case 't':
opts.touchFlag = TRUE;
Global_AppendExpand(MAKEFLAGS, "-t");
Global_Append(MAKEFLAGS, "-t");
break;
case 'w':
opts.enterFlag = TRUE;
Global_AppendExpand(MAKEFLAGS, "-w");
Global_Append(MAKEFLAGS, "-w");
break;
default:
case '?':
@ -963,7 +963,7 @@ InitVarTargets(void)
for (ln = opts.create.first; ln != NULL; ln = ln->next) {
const char *name = ln->datum;
Global_AppendExpand(".TARGETS", name);
Global_Append(".TARGETS", name);
}
}
@ -1253,8 +1253,8 @@ InitMaxJobs(void)
}
if (n != opts.maxJobs) {
Global_AppendExpand(MAKEFLAGS, "-j");
Global_AppendExpand(MAKEFLAGS, value);
Global_Append(MAKEFLAGS, "-j");
Global_Append(MAKEFLAGS, value);
}
opts.maxJobs = n;
@ -1561,7 +1561,7 @@ main_PrepareMaking(void)
{
FStr makeflags = Var_Value(MAKEFLAGS, VAR_GLOBAL);
Global_AppendExpand("MFLAGS", makeflags.str);
Global_Append("MFLAGS", makeflags.str);
FStr_Done(&makeflags);
}
@ -2112,7 +2112,7 @@ SetErrorVars(GNode *gn)
if (cmd == NULL)
break;
Global_AppendExpand(".ERROR_CMD", cmd);
Global_Append(".ERROR_CMD", cmd);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.172 2021/02/03 08:08:18 rillig Exp $ */
/* $NetBSD: meta.c,v 1.173 2021/02/03 13:53:12 rillig Exp $ */
/*
* Implement 'meta' mode.
@ -534,8 +534,8 @@ meta_create(BuildMon *pbm, GNode *gn)
fprintf(fp, "-- command output --\n");
fflush(fp);
Global_AppendExpand(".MAKE.META.FILES", fname);
Global_AppendExpand(".MAKE.META.CREATED", fname);
Global_Append(".MAKE.META.FILES", fname);
Global_Append(".MAKE.META.CREATED", fname);
gn->type |= OP_META; /* in case anyone wants to know */
if (metaSilent) {
@ -633,7 +633,7 @@ meta_mode_init(const char *make_mode)
/*
* We ignore any paths that start with ${.MAKE.META.IGNORE_PATHS}
*/
Global_AppendExpand(MAKE_META_IGNORE_PATHS,
Global_Append(MAKE_META_IGNORE_PATHS,
"/dev /etc /proc /tmp /var/run /var/tmp ${TMPDIR}");
(void)Var_Subst("${" MAKE_META_IGNORE_PATHS ":O:u:tA}",
VAR_GLOBAL, VARE_WANTRES, &metaIgnorePathsStr);
@ -1142,7 +1142,7 @@ meta_oodate(GNode *gn, Boolean oodate)
}
/* we want to track all the .meta we read */
Global_AppendExpand(".MAKE.META.FILES", fname);
Global_Append(".MAKE.META.FILES", fname);
cmdNode = gn->commands.first;
while (!oodate && (x = fgetLine(&buf, &bufsz, 0, fp)) > 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: nonints.h,v 1.193 2021/02/03 13:44:39 rillig Exp $ */
/* $NetBSD: nonints.h,v 1.194 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -377,7 +377,7 @@ void Var_Set(const char *, const char *, GNode *);
void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
void Var_Append(const char *, const char *, GNode *);
void Var_AppendExpand(const char *, const char *, GNode *);
void Global_AppendExpand(const char *, const char *);
void Global_Append(const char *, const char *);
Boolean Var_Exists(const char *, GNode *);
FStr Var_Value(const char *, GNode *);
const char *Var_ValueDirect(const char *, GNode *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.541 2021/02/03 13:44:39 rillig Exp $ */
/* $NetBSD: parse.c,v 1.542 2021/02/03 13:53:12 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.541 2021/02/03 13:44:39 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.542 2021/02/03 13:53:12 rillig Exp $");
/* types and constants */
@ -886,7 +886,7 @@ ParseDependencySourceMain(const char *src)
* Add the name to the .TARGETS variable as well, so the user can
* employ that, if desired.
*/
Global_AppendExpand(".TARGETS", src);
Global_Append(".TARGETS", src);
}
static void
@ -2375,7 +2375,7 @@ static void
ParseTrackInput(const char *name)
{
if (!VarContainsWord(MAKE_MAKEFILES, name))
Global_AppendExpand(MAKE_MAKEFILES, name);
Global_Append(MAKE_MAKEFILES, name);
}
@ -3283,7 +3283,7 @@ Parse_MainName(GNodeList *mainList)
if (mainNode->type & OP_DOUBLEDEP)
Lst_AppendAll(mainList, &mainNode->cohorts);
Global_AppendExpand(".TARGETS", mainNode->name);
Global_Append(".TARGETS", mainNode->name);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: targ.c,v 1.162 2021/02/03 08:00:36 rillig Exp $ */
/* $NetBSD: targ.c,v 1.163 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -113,7 +113,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: targ.c,v 1.162 2021/02/03 08:00:36 rillig Exp $");
MAKE_RCSID("$NetBSD: targ.c,v 1.163 2021/02/03 13:53:12 rillig Exp $");
/*
* All target nodes that appeared on the left-hand side of one of the
@ -305,7 +305,7 @@ GNode *
Targ_NewInternalNode(const char *name)
{
GNode *gn = GNode_New(name);
Global_AppendExpand(".ALLTARGETS", name);
Global_Append(".ALLTARGETS", name);
Lst_Append(&allTargets, gn);
DEBUG1(TARG, "Adding \"%s\" to all targets.\n", gn->name);
if (doing_depend)

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.794 2021/02/03 13:44:39 rillig Exp $ */
/* $NetBSD: var.c,v 1.795 2021/02/03 13:53:12 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -133,7 +133,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: var.c,v 1.794 2021/02/03 13:44:39 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.795 2021/02/03 13:53:12 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@ -750,7 +750,7 @@ ExportVars(const char *varnames, Boolean isExport, VarExportMode mode)
var_exportedVars = VAR_EXPORTED_SOME;
if (isExport && mode == VEM_PLAIN)
Global_AppendExpand(MAKE_EXPORTED, varname);
Global_Append(MAKE_EXPORTED, varname);
}
Words_Free(words);
}
@ -986,7 +986,7 @@ SetVar(const char *name, const char *val, GNode *ctxt, VarSetFlags flags)
if (!opts.varNoExportEnv)
setenv(name, val, 1);
Global_AppendExpand(MAKEOVERRIDES, name);
Global_Append(MAKEOVERRIDES, name);
}
if (name[0] == '.' && strcmp(name, MAKE_SAVE_DOLLARS) == 0)
save_dollars = ParseBoolean(val, save_dollars);
@ -1141,9 +1141,9 @@ Var_AppendExpand(const char *name, const char *val, GNode *ctxt)
}
void
Global_AppendExpand(const char *name, const char *value)
Global_Append(const char *name, const char *value)
{
Var_AppendExpand(name, value, VAR_GLOBAL);
Var_Append(name, value, VAR_GLOBAL);
}
/*