Module Name: src Committed By: rillig Date: Wed Feb 3 13:53:12 UTC 2021
Modified Files: src/usr.bin/make: dir.c job.c main.c meta.c nonints.h parse.c targ.c var.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.266 -r1.267 src/usr.bin/make/dir.c cvs rdiff -u -r1.414 -r1.415 src/usr.bin/make/job.c cvs rdiff -u -r1.528 -r1.529 src/usr.bin/make/main.c cvs rdiff -u -r1.172 -r1.173 src/usr.bin/make/meta.c cvs rdiff -u -r1.193 -r1.194 src/usr.bin/make/nonints.h cvs rdiff -u -r1.541 -r1.542 src/usr.bin/make/parse.c cvs rdiff -u -r1.162 -r1.163 src/usr.bin/make/targ.c cvs rdiff -u -r1.794 -r1.795 src/usr.bin/make/var.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/dir.c diff -u src/usr.bin/make/dir.c:1.266 src/usr.bin/make/dir.c:1.267 --- src/usr.bin/make/dir.c:1.266 Wed Feb 3 08:00:36 2021 +++ src/usr.bin/make/dir.c Wed Feb 3 13:53:12 2021 @@ -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); } } Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.414 src/usr.bin/make/job.c:1.415 --- src/usr.bin/make/job.c:1.414 Wed Feb 3 08:08:18 2021 +++ src/usr.bin/make/job.c Wed Feb 3 13:53:12 2021 @@ -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 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 Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.528 src/usr.bin/make/main.c:1.529 --- src/usr.bin/make/main.c:1.528 Wed Feb 3 08:08:18 2021 +++ src/usr.bin/make/main.c Wed Feb 3 13:53:12 2021 @@ -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 *arg 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 *argvalu 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 *argvalu 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 *argvalu 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 *argvalu 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 *argvalu 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); } } Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.172 src/usr.bin/make/meta.c:1.173 --- src/usr.bin/make/meta.c:1.172 Wed Feb 3 08:08:18 2021 +++ src/usr.bin/make/meta.c Wed Feb 3 13:53:12 2021 @@ -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) { Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.193 src/usr.bin/make/nonints.h:1.194 --- src/usr.bin/make/nonints.h:1.193 Wed Feb 3 13:44:39 2021 +++ src/usr.bin/make/nonints.h Wed Feb 3 13:53:12 2021 @@ -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 *, 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 *); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.541 src/usr.bin/make/parse.c:1.542 --- src/usr.bin/make/parse.c:1.541 Wed Feb 3 13:44:39 2021 +++ src/usr.bin/make/parse.c Wed Feb 3 13:53:12 2021 @@ -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 *sr * 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 Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.162 src/usr.bin/make/targ.c:1.163 --- src/usr.bin/make/targ.c:1.162 Wed Feb 3 08:00:36 2021 +++ src/usr.bin/make/targ.c Wed Feb 3 13:53:12 2021 @@ -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) Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.794 src/usr.bin/make/var.c:1.795 --- src/usr.bin/make/var.c:1.794 Wed Feb 3 13:44:39 2021 +++ src/usr.bin/make/var.c Wed Feb 3 13:53:12 2021 @@ -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 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 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 } 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); } /*