Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Preserve $$ in := assignments..



details:   https://anonhg.NetBSD.org/src/rev/535cb0ab0ced
branches:  trunk
changeset: 812933:535cb0ab0ced
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 09 00:55:17 2016 +0000

description:
Preserve $$ in := assignments..

FOO=\$$CRAP
BAR:=${FOO}

all:
        echo ${FOO}
        echo ${BAR}

diffstat:

 usr.bin/make/arch.c    |  14 +++++-----
 usr.bin/make/compat.c  |   8 +++---
 usr.bin/make/cond.c    |  12 ++++----
 usr.bin/make/for.c     |   8 +++---
 usr.bin/make/job.c     |  12 ++++----
 usr.bin/make/main.c    |  28 +++++++++++-----------
 usr.bin/make/make.c    |   8 +++---
 usr.bin/make/nonints.h |   7 +++--
 usr.bin/make/parse.c   |  22 ++++++++--------
 usr.bin/make/suff.c    |  10 ++++----
 usr.bin/make/var.c     |  62 ++++++++++++++++++++++++++++---------------------
 11 files changed, 100 insertions(+), 91 deletions(-)

diffs (truncated from 826 to 300 lines):

diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/arch.c       Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $    */
+/*     $NetBSD: arch.c,v 1.65 2016/01/09 00:55:17 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: arch.c,v 1.65 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)arch.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: arch.c,v 1.64 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: arch.c,v 1.65 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -261,7 +261,7 @@
            void        *freeIt;
            char        *result;
 
-           result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt);
+           result = Var_Parse(cp, ctxt, TRUE, TRUE, FALSE, &length, &freeIt);
            if (freeIt)
                free(freeIt);
            if (result == var_Error) {
@@ -276,7 +276,7 @@
 
     *cp++ = '\0';
     if (subLibName) {
-       libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE);
+       libName = Var_Subst(NULL, libName, ctxt, TRUE, TRUE, FALSE);
     }
 
 
@@ -302,7 +302,7 @@
                void    *freeIt;
                char    *result;
 
-               result = Var_Parse(cp, ctxt, TRUE, TRUE, &length, &freeIt);
+               result = Var_Parse(cp, ctxt, TRUE, TRUE, FALSE, &length, &freeIt);
                if (freeIt)
                    free(freeIt);
                if (result == var_Error) {
@@ -355,7 +355,7 @@
            char    *oldMemName = memName;
            size_t   sz;
 
-           memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE);
+           memName = Var_Subst(NULL, memName, ctxt, TRUE, TRUE, FALSE);
 
            /*
             * Now form an archive spec and recurse to deal with nested
diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/compat.c     Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $ */
+/*     $NetBSD: compat.c,v 1.102 2016/01/09 00:55:17 christos Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.102 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.101 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: compat.c,v 1.102 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -210,7 +210,7 @@
     doIt = FALSE;
     
     cmdNode = Lst_Member(gn->commands, cmd);
-    cmdStart = Var_Subst(NULL, cmd, gn, FALSE, TRUE);
+    cmdStart = Var_Subst(NULL, cmd, gn, FALSE, TRUE, FALSE);
 
     /*
      * brk_string will return an argv with a NULL in av[0], thus causing
diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/cond.c       Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $    */
+/*     $NetBSD: cond.c,v 1.72 2016/01/09 00:55:17 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.72 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $");
+__RCSID("$NetBSD: cond.c,v 1.72 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -289,7 +289,7 @@
            int         len;
            void        *freeIt;
 
-           cp2 = Var_Parse(cp, VAR_CMD, TRUE, TRUE, &len, &freeIt);
+           cp2 = Var_Parse(cp, VAR_CMD, TRUE, TRUE, FALSE, &len, &freeIt);
            Buf_AddBytes(&buf, strlen(cp2), cp2);
            if (freeIt)
                free(freeIt);
@@ -575,7 +575,7 @@
        case '$':
            /* if we are in quotes, then an undefined variable is ok */
            str = Var_Parse(condExpr, VAR_CMD, (qt ? 0 : doEval),
-                           TRUE, &len, freeIt);
+                           TRUE, FALSE, &len, freeIt);
            if (str == var_Error) {
                if (*freeIt) {
                    free(*freeIt);
@@ -827,7 +827,7 @@
     /* We do all the work here and return the result as the length */
     *argPtr = NULL;
 
-    val = Var_Parse(cp - 1, VAR_CMD, FALSE, TRUE, &length, &freeIt);
+    val = Var_Parse(cp - 1, VAR_CMD, FALSE, TRUE, FALSE, &length, &freeIt);
     /*
      * Advance *linePtr to beyond the closing ). Note that
      * we subtract one because 'length' is calculated from 'cp - 1'.
diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/for.c
--- a/usr.bin/make/for.c        Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/for.c        Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $     */
+/*     $NetBSD: for.c,v 1.51 2016/01/09 00:55:17 christos Exp $        */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.51 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)for.c      8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: for.c,v 1.50 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: for.c,v 1.51 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -216,7 +216,7 @@
      * We can't do the escapes here - because we don't know whether
      * we are substuting into ${...} or $(...).
      */
-    sub = Var_Subst(NULL, ptr, VAR_GLOBAL, FALSE, TRUE);
+    sub = Var_Subst(NULL, ptr, VAR_GLOBAL, FALSE, TRUE, FALSE);
 
     /*
      * Split into words allowing for quoted strings.
diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/job.c        Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $    */
+/*     $NetBSD: job.c,v 1.182 2016/01/09 00:55:17 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.182 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.181 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.182 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -702,7 +702,7 @@
 
     numCommands += 1;
 
-    cmdStart = cmd = Var_Subst(NULL, cmd, job->node, FALSE, TRUE);
+    cmdStart = cmd = Var_Subst(NULL, cmd, job->node, FALSE, TRUE, FALSE);
 
     cmdTemplate = "%s\n";
 
@@ -890,7 +890,7 @@
 static int
 JobSaveCommand(void *cmd, void *gn)
 {
-    cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, FALSE, TRUE);
+    cmd = Var_Subst(NULL, (char *)cmd, (GNode *)gn, FALSE, TRUE, FALSE);
     (void)Lst_AtEnd(postCommands->commands, cmd);
     return(0);
 }
@@ -2179,7 +2179,7 @@
     }
 
     targPrefix = Var_Subst(NULL, "${" MAKE_JOB_PREFIX "}",
-                          VAR_GLOBAL, FALSE, TRUE);
+                          VAR_GLOBAL, FALSE, TRUE, FALSE);
 }
 
 /*-
diff -r 2ca293304eaf -r 535cb0ab0ced usr.bin/make/main.c
--- a/usr.bin/make/main.c       Fri Jan 08 23:37:58 2016 +0000
+++ b/usr.bin/make/main.c       Sat Jan 09 00:55:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $   */
+/*     $NetBSD: main.c,v 1.236 2016/01/09 00:55:17 christos Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.236 2016/01/09 00:55:17 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.236 2016/01/09 00:55:17 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -692,7 +692,7 @@
        /* expand variable substitutions */
        if (strchr(path, '$') != 0) {
                snprintf(buf, MAXPATHLEN, "%s", path);
-               path = p = Var_Subst(NULL, buf, VAR_GLOBAL, FALSE, TRUE);
+               path = p = Var_Subst(NULL, buf, VAR_GLOBAL, FALSE, TRUE, FALSE);
        }
 
        if (path[0] != '/') {
@@ -776,7 +776,7 @@
 
     if (!mode)
        mode = mp = Var_Subst(NULL, "${" MAKE_MODE ":tl}",
-                             VAR_GLOBAL, FALSE, TRUE);
+                             VAR_GLOBAL, FALSE, TRUE, FALSE);
 
     if (mode && *mode) {
        if (strstr(mode, "compat")) {
@@ -1218,7 +1218,7 @@
                            (char *)Lst_Datum(ln));
        } else {
            p1 = Var_Subst(NULL, "${" MAKEFILE_PREFERENCE "}",
-               VAR_CMD, FALSE, TRUE);
+               VAR_CMD, FALSE, TRUE, FALSE);
            if (p1) {
                (void)str2Lst_Append(makefiles, p1, NULL);
                (void)Lst_Find(makefiles, NULL, ReadMakefile);
@@ -1229,7 +1229,7 @@
        /* In particular suppress .depend for '-r -V .OBJDIR -f /dev/null' */
        if (!noBuiltins || !printVars) {
            makeDependfile = Var_Subst(NULL, "${.MAKE.DEPENDFILE:T}",
-               VAR_CMD, FALSE, TRUE);
+               VAR_CMD, FALSE, TRUE, FALSE);
            doing_depend = TRUE;
            (void)ReadMakefile(makeDependfile, NULL);



Home | Main Index | Thread Index | Old Index