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: rename ExprStatus to ExprDefined
details: https://anonhg.NetBSD.org/src/rev/d7ba3ae0d4df
branches: trunk
changeset: 959488:d7ba3ae0d4df
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Feb 15 18:21:13 2021 +0000
description:
make: rename ExprStatus to ExprDefined
The type describes the definedness of an expression, not a general
status, therefore the new name is more precise.
The constants are renamed as well since their prefix 'VES' does not
match the type name anymore, it was correct 3 days ago when the type was
still named VarExprStatus. The name VES_NONE was misleading since
'none' does not describe its actual effect. That name came from the
time when the status was a bit set, and 'none' simply meant 'none of the
bits are set'.
The names used in debug logging will be renamed in a follow-up commit,
to demonstrate that the changes in this commit indeed have no functional
change, especially not the change from '!=' to '==' in line 4304.
No functional change.
diffstat:
usr.bin/make/var.c | 56 +++++++++++++++++++++++++++---------------------------
1 files changed, 28 insertions(+), 28 deletions(-)
diffs (166 lines):
diff -r 36377a290ace -r d7ba3ae0d4df usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Feb 15 17:59:08 2021 +0000
+++ b/usr.bin/make/var.c Mon Feb 15 18:21:13 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.824 2021/02/15 17:59:08 rillig Exp $ */
+/* $NetBSD: var.c,v 1.825 2021/02/15 18:21:13 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.824 2021/02/15 17:59:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.825 2021/02/15 18:21:13 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@@ -2001,23 +2001,23 @@
* Some modifiers need to free some memory.
*/
-typedef enum ExprStatus {
+typedef enum ExprDefined {
/* The variable expression is based on a regular, defined variable. */
- VES_NONE,
+ DEF_REGULAR,
/* The variable expression is based on an undefined variable. */
- VES_UNDEF,
+ DEF_UNDEF,
/*
* The variable expression started as an undefined expression, but one
- * of the modifiers (such as :D or :U) has turned the expression from
- * undefined to defined.
+ * of the modifiers (such as ':D' or ':U') has turned the expression
+ * from undefined to defined.
*/
- VES_DEF
-} ExprStatus;
-
-static const char *const ExprStatus_Name[] = {
- "none",
- "VES_UNDEF",
- "VES_DEF"
+ DEF_DEFINED
+} ExprDefined;
+
+static const char *const ExprDefined_Name[] = {
+ "none", /* TODO: rename */
+ "VES_UNDEF", /* TODO: rename */
+ "VES_DEF" /* TODO: rename */
};
/* A variable expression such as $@ or ${VAR:Mpattern:Q}. */
@@ -2026,7 +2026,7 @@
FStr value;
VarEvalFlags const eflags;
GNode *const scope;
- ExprStatus status;
+ ExprDefined defined;
} Expr;
/*
@@ -2059,8 +2059,8 @@
static void
Expr_Define(Expr *expr)
{
- if (expr->status == VES_UNDEF)
- expr->status = VES_DEF;
+ if (expr->defined == DEF_UNDEF)
+ expr->defined = DEF_DEFINED;
}
static void
@@ -2429,7 +2429,7 @@
VarEvalFlags eflags = VARE_NONE;
if (expr->eflags & VARE_WANTRES)
- if ((**pp == 'D') == (expr->status == VES_NONE))
+ if ((**pp == 'D') == (expr->defined == DEF_REGULAR))
eflags = expr->eflags;
Buf_Init(&buf);
@@ -3298,7 +3298,7 @@
}
scope = expr->scope; /* scope where v belongs */
- if (expr->status == VES_NONE && expr->scope != SCOPE_GLOBAL) {
+ if (expr->defined == DEF_REGULAR && expr->scope != SCOPE_GLOBAL) {
Var *gv = VarFind(expr->var->name.str, expr->scope, FALSE);
if (gv == NULL)
scope = SCOPE_GLOBAL;
@@ -3341,7 +3341,7 @@
break;
}
case '?':
- if (expr->status == VES_NONE)
+ if (expr->defined == DEF_REGULAR)
break;
/* FALLTHROUGH */
default:
@@ -3503,7 +3503,7 @@
expr->value.str,
VarEvalFlags_ToString(eflags_str, expr->eflags),
VarFlags_ToString(vflags_str, expr->var->flags),
- ExprStatus_Name[expr->status]);
+ ExprDefined_Name[expr->defined]);
}
static void
@@ -3520,7 +3520,7 @@
quot, value == var_Error ? "error" : value, quot,
VarEvalFlags_ToString(eflags_str, expr->eflags),
VarFlags_ToString(vflags_str, expr->var->flags),
- ExprStatus_Name[expr->status]);
+ ExprDefined_Name[expr->defined]);
}
static ApplyModifierResult
@@ -4050,7 +4050,7 @@
Boolean *out_TRUE_haveModifier,
const char **out_TRUE_extraModifiers,
Boolean *out_TRUE_dynamic,
- ExprStatus *out_TRUE_exprStatus
+ ExprDefined *out_TRUE_exprDefined
)
{
size_t namelen;
@@ -4119,7 +4119,7 @@
* instead of the actually computed value.
*/
v = VarNew(FStr_InitOwn(varname), "", VAR_NONE);
- *out_TRUE_exprStatus = VES_UNDEF;
+ *out_TRUE_exprDefined = DEF_UNDEF;
} else
free(varname);
@@ -4215,7 +4215,7 @@
#endif
eflags,
scope,
- VES_NONE
+ DEF_REGULAR
};
DEBUG2(VAR, "Var_Parse: %s with %s\n", start,
@@ -4244,7 +4244,7 @@
if (!ParseVarnameLong(p, startc, scope, eflags,
pp, &res, out_val,
&endc, &p, &expr.var, &haveModifier, &extramodifiers,
- &dynamic, &expr.status))
+ &dynamic, &expr.defined))
return res;
}
@@ -4300,8 +4300,8 @@
if (v->flags & VAR_FROM_ENV) {
FreeEnvVar(&expr.value.freeIt, v, expr.value.str);
- } else if (expr.status != VES_NONE) { /* XXX: rename VES_NONE */
- if (expr.status != VES_DEF) { /* XXX: replace '!=' with '==' */
+ } else if (expr.defined != DEF_REGULAR) {
+ if (expr.defined == DEF_UNDEF) {
if (dynamic) {
Expr_SetValueOwn(&expr,
bmake_strsedup(start, p));
Home |
Main Index |
Thread Index |
Old Index