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: clean up calls to Var_Subst
details: https://anonhg.NetBSD.org/src/rev/9249cab0d004
branches: trunk
changeset: 373530:9249cab0d004
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Feb 14 21:38:31 2023 +0000
description:
make: clean up calls to Var_Subst
None of the calls to Var_Subst used the return value, and the return
value was always VPR_OK.
No functional change.
diffstat:
usr.bin/make/compat.c | 6 +++---
usr.bin/make/for.c | 8 +++++---
usr.bin/make/job.c | 15 +++++++--------
usr.bin/make/main.c | 45 ++++++++++++++++++++-------------------------
usr.bin/make/make.c | 6 +++---
usr.bin/make/make.h | 4 ++--
usr.bin/make/meta.c | 30 +++++++++++++++---------------
usr.bin/make/parse.c | 20 +++++++++-----------
usr.bin/make/suff.c | 6 +++---
usr.bin/make/var.c | 44 +++++++++++++++++++-------------------------
10 files changed, 86 insertions(+), 98 deletions(-)
diffs (truncated from 648 to 300 lines):
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/compat.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.244 2023/01/17 21:35:19 christos Exp $ */
+/* $NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.244 2023/01/17 21:35:19 christos Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.245 2023/02/14 21:38:31 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -238,7 +238,7 @@
errCheck = !(gn->type & OP_IGNORE);
doIt = false;
- (void)Var_Subst(cmd, gn, VARE_WANTRES, &cmdStart);
+ cmdStart = Var_Subst(cmd, gn, VARE_WANTRES);
/* TODO: handle errors */
if (cmdStart[0] == '\0') {
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/for.c
--- a/usr.bin/make/for.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/for.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.170 2022/09/03 00:50:07 rillig Exp $ */
+/* $NetBSD: for.c,v 1.171 2023/02/14 21:38:31 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: for.c,v 1.170 2022/09/03 00:50:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.171 2023/02/14 21:38:31 rillig Exp $");
typedef struct ForLoop {
@@ -168,7 +168,9 @@
cpp_skip_whitespace(&p);
- if (Var_Subst(p, SCOPE_GLOBAL, VARE_WANTRES, &items) != VPR_OK) {
+ items = Var_Subst(p, SCOPE_GLOBAL, VARE_WANTRES);
+ if (items == var_Error) {
+ /* TODO: Make this part of the code reachable. */
Parse_Error(PARSE_FATAL, "Error in .for loop items");
return false;
}
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/job.c
--- a/usr.bin/make/job.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/job.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.457 2023/01/17 21:35:19 christos Exp $ */
+/* $NetBSD: job.c,v 1.458 2023/02/14 21:38:31 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.457 2023/01/17 21:35:19 christos Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.458 2023/02/14 21:38:31 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -911,7 +911,7 @@
run = GNode_ShouldExecute(job->node);
- (void)Var_Subst(ucmd, job->node, VARE_WANTRES, &xcmd);
+ xcmd = Var_Subst(ucmd, job->node, VARE_WANTRES);
/* TODO: handle errors */
xcmdStart = xcmd;
@@ -1040,7 +1040,7 @@
* variables such as .TARGET, .IMPSRC. It is not intended to
* expand the other variables as well; see deptgt-end.mk.
*/
- (void)Var_Subst(cmd, job->node, VARE_WANTRES, &expanded_cmd);
+ expanded_cmd = Var_Subst(cmd, job->node, VARE_WANTRES);
/* TODO: handle errors */
Lst_Append(&Targ_GetEndNode()->commands, expanded_cmd);
}
@@ -1076,8 +1076,7 @@
debug_printf("\t%s\n", cmd);
if (strchr(cmd, '$') != NULL) {
- char *xcmd;
- (void)Var_Subst(cmd, job->node, VARE_WANTRES, &xcmd);
+ char *xcmd = Var_Subst(cmd, job->node, VARE_WANTRES);
debug_printf("\t=> %s\n", xcmd);
free(xcmd);
}
@@ -2201,8 +2200,8 @@
Global_Set(MAKE_JOB_PREFIX, "---");
}
- (void)Var_Subst("${" MAKE_JOB_PREFIX "}",
- SCOPE_GLOBAL, VARE_WANTRES, &targPrefix);
+ targPrefix = Var_Subst("${" MAKE_JOB_PREFIX "}",
+ SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
}
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/main.c
--- a/usr.bin/make/main.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/main.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.589 2023/01/26 20:48:17 sjg Exp $ */
+/* $NetBSD: main.c,v 1.590 2023/02/14 21:38:31 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.589 2023/01/26 20:48:17 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.590 2023/02/14 21:38:31 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -788,9 +788,8 @@
static void
MakeMode(void)
{
- char *mode;
-
- (void)Var_Subst("${" MAKE_MODE ":tl}", SCOPE_GLOBAL, VARE_WANTRES, &mode);
+ char *mode = Var_Subst("${" MAKE_MODE ":tl}",
+ SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
if (mode[0] != '\0') {
@@ -813,16 +812,14 @@
PrintVar(const char *varname, bool expandVars)
{
if (strchr(varname, '$') != NULL) {
- char *evalue;
- (void)Var_Subst(varname, SCOPE_GLOBAL, VARE_WANTRES, &evalue);
+ char *evalue = Var_Subst(varname, SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
printf("%s\n", evalue);
free(evalue);
} else if (expandVars) {
char *expr = str_concat3("${", varname, "}");
- char *evalue;
- (void)Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES, &evalue);
+ char *evalue = Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
free(expr);
printf("%s\n", evalue);
@@ -848,7 +845,7 @@
char *value;
bool res;
- (void)Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES, &value);
+ value = Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
res = ParseBoolean(value, fallback);
free(value);
@@ -1205,7 +1202,7 @@
!Var_Exists(SCOPE_GLOBAL, ".MAKE.JOBS"))
return;
- (void)Var_Subst("${.MAKE.JOBS}", SCOPE_GLOBAL, VARE_WANTRES, &value);
+ value = Var_Subst("${.MAKE.JOBS}", SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
n = (int)strtol(value, NULL, 0);
if (n < 1) {
@@ -1240,7 +1237,7 @@
if (!Var_Exists(SCOPE_CMDLINE, "VPATH"))
return;
- (void)Var_Subst("${VPATH}", SCOPE_CMDLINE, VARE_WANTRES, &vpath);
+ vpath = Var_Subst("${VPATH}", SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
path = vpath;
do {
@@ -1276,10 +1273,8 @@
{
StringList makefiles = LST_INIT;
StringListNode *ln;
- char *prefs;
-
- (void)Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
- SCOPE_CMDLINE, VARE_WANTRES, &prefs);
+ char *prefs = Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
+ SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
(void)str2Lst_Append(&makefiles, prefs);
@@ -1498,8 +1493,8 @@
{
/* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
if (!opts.noBuiltins || opts.printVars == PVM_NONE) {
- (void)Var_Subst("${.MAKE.DEPENDFILE}",
- SCOPE_CMDLINE, VARE_WANTRES, &makeDependfile);
+ makeDependfile = Var_Subst("${.MAKE.DEPENDFILE}",
+ SCOPE_CMDLINE, VARE_WANTRES);
if (makeDependfile[0] != '\0') {
/* TODO: handle errors */
doing_depend = true;
@@ -2061,9 +2056,9 @@
SetErrorVars(gn);
{
- char *errorVarsValues;
- (void)Var_Subst("${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
- SCOPE_GLOBAL, VARE_WANTRES, &errorVarsValues);
+ char *errorVarsValues = Var_Subst(
+ "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
+ SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
printf("%s", errorVarsValues);
free(errorVarsValues);
@@ -2091,9 +2086,9 @@
return;
once = false;
- (void)Var_Subst(
+ flags = Var_Subst(
"${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}",
- SCOPE_CMDLINE, VARE_WANTRES, &flags);
+ SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
if (flags[0] != '\0') {
#ifdef POSIX
@@ -2114,8 +2109,8 @@
return tmpdir;
/* Honor $TMPDIR if it is valid, strip a trailing '/'. */
- (void)Var_Subst("${TMPDIR:tA:U" _PATH_TMP ":S,/$,,W}/",
- SCOPE_GLOBAL, VARE_WANTRES, &tmpdir);
+ tmpdir = Var_Subst("${TMPDIR:tA:U" _PATH_TMP ":S,/$,,W}/",
+ SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
if (stat(tmpdir, &st) < 0 || !S_ISDIR(st.st_mode)) {
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/make.c
--- a/usr.bin/make/make.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/make.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.258 2022/12/05 23:28:08 rillig Exp $ */
+/* $NetBSD: make.c,v 1.259 2023/02/14 21:38:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.258 2022/12/05 23:28:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.259 2023/02/14 21:38:31 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked_seqno = 1;
@@ -445,7 +445,7 @@
} else {
free(gn->name);
}
- (void)Var_Subst(gn->uname, pgn, VARE_WANTRES, &gn->name);
+ gn->name = Var_Subst(gn->uname, pgn, VARE_WANTRES);
/* TODO: handle errors */
if (gn->uname != NULL && strcmp(gn->name, gn->uname) != 0) {
/* See if we have a target for this node. */
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/make.h
--- a/usr.bin/make/make.h Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/make.h Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.312 2023/02/14 21:08:00 rillig Exp $ */
+/* $NetBSD: make.h,v 1.313 2023/02/14 21:38:31 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -1018,7 +1018,7 @@
FStr Var_Value(GNode *, const char *) MAKE_ATTR_USE;
const char *GNode_ValueDirect(GNode *, const char *) MAKE_ATTR_USE;
FStr Var_Parse(const char **, GNode *, VarEvalMode);
-VarParseResult Var_Subst(const char *, GNode *, VarEvalMode, char **);
+char *Var_Subst(const char *, GNode *, VarEvalMode);
void Var_Expand(FStr *, GNode *, VarEvalMode);
void Var_Stats(void);
void Var_Dump(GNode *);
diff -r 4c1e4135371b -r 9249cab0d004 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Tue Feb 14 21:08:00 2023 +0000
+++ b/usr.bin/make/meta.c Tue Feb 14 21:38:31 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.201 2022/09/28 16:34:47 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.202 2023/02/14 21:38:31 rillig Exp $ */
Home |
Main Index |
Thread Index |
Old Index