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(1): rename VAR_CMD to VAR_CMDLINE



details:   https://anonhg.NetBSD.org/src/rev/f3c5a6bc53e3
branches:  trunk
changeset: 977631:f3c5a6bc53e3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 30 07:19:30 2020 +0000

description:
make(1): rename VAR_CMD to VAR_CMDLINE

Since make has to do with both the command line and child commands, the
former name was confusing.

diffstat:

 usr.bin/make/cond.c  |  14 ++++++++------
 usr.bin/make/job.c   |   6 +++---
 usr.bin/make/main.c  |  24 ++++++++++++------------
 usr.bin/make/make.h  |   6 +++---
 usr.bin/make/parse.c |  22 +++++++++++-----------
 usr.bin/make/targ.c  |   6 +++---
 usr.bin/make/var.c   |  52 ++++++++++++++++++++++++++--------------------------
 7 files changed, 66 insertions(+), 64 deletions(-)

diffs (truncated from 509 to 300 lines):

diff -r ac2ed861dab3 -r f3c5a6bc53e3 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Oct 30 07:17:29 2020 +0000
+++ b/usr.bin/make/cond.c       Fri Oct 30 07:19:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.170 2020/10/30 07:19:30 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.169 2020/10/26 21:34:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.170 2020/10/30 07:19:30 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -246,7 +246,8 @@
            void *nestedVal_freeIt;
            VarEvalFlags eflags = VARE_UNDEFERR | (doEval ? VARE_WANTRES : 0);
            const char *nestedVal;
-           (void)Var_Parse(&p, VAR_CMD, eflags, &nestedVal, &nestedVal_freeIt);
+           (void)Var_Parse(&p, VAR_CMDLINE, eflags, &nestedVal,
+                           &nestedVal_freeIt);
            /* TODO: handle errors */
            Buf_AddStr(&argBuf, nestedVal);
            free(nestedVal_freeIt);
@@ -283,7 +284,7 @@
 FuncDefined(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
     char *freeIt;
-    Boolean result = Var_Value(arg, VAR_CMD, &freeIt) != NULL;
+    Boolean result = Var_Value(arg, VAR_CMDLINE, &freeIt) != NULL;
     bmake_free(freeIt);
     return result;
 }
@@ -443,7 +444,8 @@
                     (doEval ? VARE_WANTRES : 0);
            nested_p = par->p;
            atStart = nested_p == start;
-           parseResult = Var_Parse(&nested_p, VAR_CMD, eflags, &str, freeIt);
+           parseResult = Var_Parse(&nested_p, VAR_CMDLINE, eflags, &str,
+                                   freeIt);
            /* TODO: handle errors */
            if (str == var_Error) {
                if (parseResult & VPR_ANY_MSG)
@@ -683,7 +685,7 @@
     *argPtr = NULL;
 
     (*linePtr)--;              /* Make (*linePtr)[1] point to the '('. */
-    (void)Var_Parse(linePtr, VAR_CMD, doEval ? VARE_WANTRES : 0,
+    (void)Var_Parse(linePtr, VAR_CMDLINE, doEval ? VARE_WANTRES : 0,
                    &val, &val_freeIt);
     /* TODO: handle errors */
     /* If successful, *linePtr points beyond the closing ')' now. */
diff -r ac2ed861dab3 -r f3c5a6bc53e3 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Oct 30 07:17:29 2020 +0000
+++ b/usr.bin/make/job.c        Fri Oct 30 07:19:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.294 2020/10/30 07:19:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.293 2020/10/26 23:28:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.294 2020/10/30 07:19:30 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -2059,7 +2059,7 @@
 #endif
        shellPath = str_concat3(_PATH_DEFSHELLDIR, "/", shellName);
     }
-    Var_Set_with_flags(".SHELL", shellPath, VAR_CMD, VAR_SET_READONLY);
+    Var_Set_with_flags(".SHELL", shellPath, VAR_CMDLINE, VAR_SET_READONLY);
     if (commandShell->exit == NULL) {
        commandShell->exit = "";
     }
diff -r ac2ed861dab3 -r f3c5a6bc53e3 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Fri Oct 30 07:17:29 2020 +0000
+++ b/usr.bin/make/main.c       Fri Oct 30 07:19:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.410 2020/10/30 07:19:30 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.410 2020/10/30 07:19:30 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -649,7 +649,7 @@
        for (; argc > 1; ++argv, --argc) {
                VarAssign var;
                if (Parse_IsVar(argv[1], &var)) {
-                       Parse_DoVar(&var, VAR_CMD);
+                       Parse_DoVar(&var, VAR_CMDLINE);
                } else {
                        if (!*argv[1])
                                Punt("illegal (null) argument.");
@@ -743,7 +743,7 @@
 Main_SetVarObjdir(const char *var, const char *suffix)
 {
        char *path_freeIt;
-       const char *path = Var_Value(var, VAR_CMD, &path_freeIt);
+       const char *path = Var_Value(var, VAR_CMDLINE, &path_freeIt);
        const char *xpath;
        char *xpath_freeIt;
 
@@ -1036,12 +1036,12 @@
        if (ignorePWD || (pwd = getenv("PWD")) == NULL)
                return;
 
-       if (Var_Value("MAKEOBJDIRPREFIX", VAR_CMD, &prefix_freeIt) != NULL) {
+       if (Var_Value("MAKEOBJDIRPREFIX", VAR_CMDLINE, &prefix_freeIt) != NULL) {
                bmake_free(prefix_freeIt);
                return;
        }
 
-       makeobjdir = Var_Value("MAKEOBJDIR", VAR_CMD, &makeobjdir_freeIt);
+       makeobjdir = Var_Value("MAKEOBJDIR", VAR_CMDLINE, &makeobjdir_freeIt);
        if (makeobjdir != NULL && strchr(makeobjdir, '$') != NULL)
                goto ignore_pwd;
 
@@ -1236,10 +1236,10 @@
 InitVpath(void)
 {
        char *vpath, savec, *path;
-       if (!Var_Exists("VPATH", VAR_CMD))
+       if (!Var_Exists("VPATH", VAR_CMDLINE))
                return;
 
-       (void)Var_Subst("${VPATH}", VAR_CMD, VARE_WANTRES, &vpath);
+       (void)Var_Subst("${VPATH}", VAR_CMDLINE, VARE_WANTRES, &vpath);
        /* TODO: handle errors */
        path = vpath;
        do {
@@ -1272,7 +1272,7 @@
        } else {
                char *p1;
                (void)Var_Subst("${" MAKEFILE_PREFERENCE "}",
-                               VAR_CMD, VARE_WANTRES, &p1);
+                               VAR_CMDLINE, VARE_WANTRES, &p1);
                /* TODO: handle errors */
                (void)str2Lst_Append(opts.makefiles, p1, NULL);
                (void)Lst_ForEachUntil(opts.makefiles,
@@ -1426,7 +1426,7 @@
        Var_Set("MFLAGS", "", VAR_GLOBAL);
        Var_Set(".ALLTARGETS", "", VAR_GLOBAL);
        /* some makefiles need to know this */
-       Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMD);
+       Var_Set(MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV, VAR_CMDLINE);
 
        /*
         * Set some other useful macros
@@ -1530,7 +1530,7 @@
        if (!opts.noBuiltins || !opts.printVars) {
            /* ignore /dev/null and anything starting with "no" */
            (void)Var_Subst("${.MAKE.DEPENDFILE:N/dev/null:Nno*:T}",
-               VAR_CMD, VARE_WANTRES, &makeDependfile);
+                           VAR_CMDLINE, VARE_WANTRES, &makeDependfile);
            if (makeDependfile[0] != '\0') {
                /* TODO: handle errors */
                doing_depend = TRUE;
@@ -2127,7 +2127,7 @@
     once = FALSE;
 
     expr = "${.MAKEFLAGS} ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}";
-    (void)Var_Subst(expr, VAR_CMD, VARE_WANTRES, &s);
+    (void)Var_Subst(expr, VAR_CMDLINE, VARE_WANTRES, &s);
     /* TODO: handle errors */
     if (s[0] != '\0') {
 #ifdef POSIX
diff -r ac2ed861dab3 -r f3c5a6bc53e3 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Fri Oct 30 07:17:29 2020 +0000
+++ b/usr.bin/make/make.h       Fri Oct 30 07:19:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.175 2020/10/28 03:21:25 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.176 2020/10/30 07:19:30 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -362,7 +362,7 @@
     /* The "local" variables that are specific to this target and this target
      * only, such as $@, $<, $?.
      *
-     * Also used for the global variable scopes VAR_GLOBAL, VAR_CMD,
+     * Also used for the global variable scopes VAR_GLOBAL, VAR_CMDLINE,
      * VAR_INTERNAL, which contain variables with arbitrary names. */
     HashTable context;
 
@@ -435,7 +435,7 @@
                                 */
 extern GNode    *VAR_GLOBAL;   /* Variables defined in a global context, e.g
                                 * in the Makefile itself */
-extern GNode    *VAR_CMD;      /* Variables defined on the command line */
+extern GNode    *VAR_CMDLINE;  /* Variables defined on the command line */
 extern char    var_Error[];    /* Value returned by Var_Parse when an error
                                 * is encountered. It actually points to
                                 * an empty string, so naive callers needn't
diff -r ac2ed861dab3 -r f3c5a6bc53e3 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Oct 30 07:17:29 2020 +0000
+++ b/usr.bin/make/parse.c      Fri Oct 30 07:19:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.410 2020/10/29 20:37:47 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.411 2020/10/30 07:19:30 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.410 2020/10/29 20:37:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.411 2020/10/30 07:19:30 rillig Exp $");
 
 /* types and constants */
 
@@ -741,7 +741,7 @@
        return FALSE;           /* missing argument */
 
     cpp_skip_whitespace(&p);
-    (void)Var_Subst(p, VAR_CMD, VARE_WANTRES, &arg);
+    (void)Var_Subst(p, VAR_CMDLINE, VARE_WANTRES, &arg);
     /* TODO: handle errors */
 
     Parse_Error(mtype, "%s", arg);
@@ -1063,7 +1063,7 @@
            const char *nested_val;
            void *freeIt;
 
-           (void)Var_Parse(&nested_p, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES,
+           (void)Var_Parse(&nested_p, VAR_CMDLINE, VARE_UNDEFERR|VARE_WANTRES,
                            &nested_val, &freeIt);
            /* TODO: handle errors */
            free(freeIt);
@@ -1477,7 +1477,7 @@
             * went well and FALSE if there was an error in the
             * specification. On error, line should remain untouched.
             */
-           if (!Arch_ParseArchive(&line, targets, VAR_CMD)) {
+           if (!Arch_ParseArchive(&line, targets, VAR_CMDLINE)) {
                Parse_Error(PARSE_FATAL,
                            "Error in archive specification: \"%s\"", line);
                return FALSE;
@@ -1579,7 +1579,7 @@
 
        if (*end == '(') {
            GNodeList *sources = Lst_New();
-           if (!Arch_ParseArchive(&start, sources, VAR_CMD)) {
+           if (!Arch_ParseArchive(&start, sources, VAR_CMDLINE)) {
                Parse_Error(PARSE_FATAL,
                            "Error in source archive spec \"%s\"", start);
                return FALSE;
@@ -1952,7 +1952,7 @@
     cmd = uvalue;
     if (strchr(cmd, '$') != NULL) {
        char *ecmd;
-       (void)Var_Subst(cmd, VAR_CMD, VARE_UNDEFERR|VARE_WANTRES, &ecmd);
+       (void)Var_Subst(cmd, VAR_CMDLINE, VARE_UNDEFERR | VARE_WANTRES, &ecmd);
        /* TODO: handle errors */
        cmd = cmd_freeIt = ecmd;
     }
@@ -2274,7 +2274,7 @@
      * Substitute for any variables in the file name before trying to
      * find the thing.
      */
-    (void)Var_Subst(file, VAR_CMD, VARE_WANTRES, &file);
+    (void)Var_Subst(file, VAR_CMDLINE, VARE_WANTRES, &file);
     /* TODO: handle errors */
 
     Parse_include_file(file, endc == '>', *line == 'd', silent);
@@ -2489,7 +2489,7 @@
      * Substitute for any variables in the file name before trying to
      * find the thing.
      */
-    (void)Var_Subst(file, VAR_CMD, VARE_WANTRES, &all_files);
+    (void)Var_Subst(file, VAR_CMDLINE, VARE_WANTRES, &all_files);
     /* TODO: handle errors */
 
     if (*file == '\0') {
@@ -2539,7 +2539,7 @@
     /*
      * Expand the value before putting it in the environment.
      */
-    (void)Var_Subst(value, VAR_CMD, VARE_WANTRES, &value);
+    (void)Var_Subst(value, VAR_CMDLINE, VARE_WANTRES, &value);
     /* TODO: handle errors */
 
     setenv(variable, value, 1);



Home | Main Index | Thread Index | Old Index