make: inline macros for variable names

The variable name '.MAKEOVERRIDES' was already used in the non-macro
form.

No binary change.
This commit is contained in:
rillig 2023-02-15 06:52:58 +00:00
parent 20bc004c0c
commit 6d7e33c958
6 changed files with 26 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.458 2023/02/14 21:38:31 rillig Exp $ */
/* $NetBSD: job.c,v 1.459 2023/02/15 06:52:58 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.458 2023/02/14 21:38:31 rillig Exp $");
MAKE_RCSID("$NetBSD: job.c,v 1.459 2023/02/15 06:52:58 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@ -2196,11 +2196,11 @@ Job_SetPrefix(void)
{
if (targPrefix != NULL) {
free(targPrefix);
} else if (!Var_Exists(SCOPE_GLOBAL, MAKE_JOB_PREFIX)) {
Global_Set(MAKE_JOB_PREFIX, "---");
} else if (!Var_Exists(SCOPE_GLOBAL, ".MAKE.JOB.PREFIX")) {
Global_Set(".MAKE.JOB.PREFIX", "---");
}
targPrefix = Var_Subst("${" MAKE_JOB_PREFIX "}",
targPrefix = Var_Subst("${.MAKE.JOB.PREFIX}",
SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.590 2023/02/14 21:38:31 rillig Exp $ */
/* $NetBSD: main.c,v 1.591 2023/02/15 06:52:58 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.590 2023/02/14 21:38:31 rillig Exp $");
MAKE_RCSID("$NetBSD: main.c,v 1.591 2023/02/15 06:52:58 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@ -440,7 +440,7 @@ MainParseArg(char c, const char *argvalue)
case 'B':
opts.compatMake = true;
Global_Append(MAKEFLAGS, "-B");
Global_Set(MAKE_MODE, "compat");
Global_Set(".MAKE.MODE", "compat");
break;
case 'C':
MainParseArgChdir(argvalue);
@ -788,7 +788,7 @@ siginfo(int signo MAKE_ATTR_UNUSED)
static void
MakeMode(void)
{
char *mode = Var_Subst("${" MAKE_MODE ":tl}",
char *mode = Var_Subst("${.MAKE.MODE:tl}",
SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
@ -1273,7 +1273,7 @@ ReadFirstDefaultMakefile(void)
{
StringList makefiles = LST_INIT;
StringListNode *ln;
char *prefs = Var_Subst("${" MAKE_MAKEFILE_PREFERENCE "}",
char *prefs = Var_Subst("${.MAKE.MAKEFILE_PREFERENCE}",
SCOPE_CMDLINE, VARE_WANTRES);
/* TODO: handle errors */
@ -1352,7 +1352,7 @@ main_Init(int argc, char **argv)
/* This is the traditional preference for makefiles. */
# define MAKEFILE_PREFERENCE_LIST "makefile Makefile"
#endif
Global_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST);
Global_Set(".MAKE.MAKEFILE_PREFERENCE", MAKEFILE_PREFERENCE_LIST);
Global_Set(".MAKE.DEPENDFILE", ".depend");
CmdOpts_Init();
@ -1378,7 +1378,7 @@ main_Init(int argc, char **argv)
Parse_Init();
InitVarMake(argv[0]);
Global_Set(MAKEFLAGS, "");
Global_Set(MAKEOVERRIDES, "");
Global_Set(".MAKEOVERRIDES", "");
Global_Set("MFLAGS", "");
Global_Set(".ALLTARGETS", "");
Var_Set(SCOPE_CMDLINE, ".MAKE.LEVEL.ENV", MAKE_LEVEL_ENV);
@ -1391,7 +1391,7 @@ main_Init(int argc, char **argv)
if (makelevel < 0)
makelevel = 0;
snprintf(buf, sizeof buf, "%d", makelevel);
Global_Set(MAKE_LEVEL, buf);
Global_Set(".MAKE.LEVEL", buf);
snprintf(buf, sizeof buf, "%u", myPid);
Global_Set_ReadOnly(".MAKE.PID", buf);
snprintf(buf, sizeof buf, "%u", getppid());

View File

@ -1,4 +1,4 @@
/* $NetBSD: make.h,v 1.315 2023/02/15 06:31:51 rillig Exp $ */
/* $NetBSD: make.h,v 1.316 2023/02/15 06:52:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -609,13 +609,6 @@ extern GNode *mainNode;
extern pid_t myPid;
#define MAKEFLAGS ".MAKEFLAGS"
#define MAKEOVERRIDES ".MAKEOVERRIDES"
/* prefix when printing the target of a job */
#define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
#define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */
#define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
#define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
#define MAKE_MODE ".MAKE.MODE"
#ifndef MAKE_LEVEL_ENV
# define MAKE_LEVEL_ENV "MAKELEVEL"
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $ */
/* $NetBSD: parse.c,v 1.696 2023/02/15 06:52:58 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -105,7 +105,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.696 2023/02/15 06:52:58 rillig Exp $");
/*
* A file being read.
@ -1870,7 +1870,7 @@ VarAssign_Eval(const char *name, VarAssignOp op, const char *uvalue,
static void
VarAssignSpecial(const char *name, const char *avalue)
{
if (strcmp(name, MAKEOVERRIDES) == 0)
if (strcmp(name, ".MAKEOVERRIDES") == 0)
Main_ExportMAKEFLAGS(false); /* re-export MAKEFLAGS */
else if (strcmp(name, ".CURDIR") == 0) {
/*
@ -1880,7 +1880,7 @@ VarAssignSpecial(const char *name, const char *avalue)
*/
Dir_InitCur(avalue);
Dir_SetPATH();
} else if (strcmp(name, MAKE_JOB_PREFIX) == 0)
} else if (strcmp(name, ".MAKE.JOB.PREFIX") == 0)
Job_SetPrefix();
else if (strcmp(name, ".MAKE.EXPORTED") == 0)
Var_ExportVars(avalue);
@ -2146,8 +2146,8 @@ VarContainsWord(const char *varname, const char *word)
static void
TrackInput(const char *name)
{
if (!VarContainsWord(MAKE_MAKEFILES, name))
Global_Append(MAKE_MAKEFILES, name);
if (!VarContainsWord(".MAKE.MAKEFILES", name))
Global_Append(".MAKE.MAKEFILES", name);
}

View File

@ -1,6 +1,6 @@
# $NetBSD: varname-dot-makeoverrides.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
# $NetBSD: varname-dot-makeoverrides.mk,v 1.3 2023/02/15 06:52:59 rillig Exp $
#
# Tests for the special .MAKE.MAKEOVERRIDES variable.
# Tests for the special .MAKEOVERRIDES variable.
# TODO: Implementation

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.1045 2023/02/15 06:31:51 rillig Exp $ */
/* $NetBSD: var.c,v 1.1046 2023/02/15 06:52:58 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.1045 2023/02/15 06:31:51 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.1046 2023/02/15 06:52:58 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@ -1001,7 +1001,7 @@ Var_SetWithFlags(GNode *scope, const char *name, const char *val,
/*
* If requested, don't export these in the environment
* individually. We still put them in MAKEOVERRIDES so
* individually. We still put them in .MAKEOVERRIDES so
* that the command-line settings continue to override
* Makefile settings.
*/
@ -1013,7 +1013,7 @@ Var_SetWithFlags(GNode *scope, const char *name, const char *val,
* in ExportVarPlain?
*/
Global_Append(MAKEOVERRIDES, name);
Global_Append(".MAKEOVERRIDES", name);
}
if (name[0] == '.' && strcmp(name, MAKE_SAVE_DOLLARS) == 0)