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): merge VARE_NOSUBST into VARE_WANTRES



details:   https://anonhg.NetBSD.org/src/rev/ab530aded5f6
branches:  trunk
changeset: 936419:ab530aded5f6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 26 18:11:12 2020 +0000

description:
make(1): merge VARE_NOSUBST into VARE_WANTRES

The flag VARE_NOSUBST is only a few days old. It had grown out of the
VARP_NOSUBST and VAR_NOSUBST flags, not knowing at that time that it
meant the exact opposite of VARE_WANTRES.

diffstat:

 usr.bin/make/nonints.h |   9 +++------
 usr.bin/make/var.c     |  15 +++++++--------
 2 files changed, 10 insertions(+), 14 deletions(-)

diffs (88 lines):

diff -r 862fda7f8434 -r ab530aded5f6 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Sun Jul 26 18:10:00 2020 +0000
+++ b/usr.bin/make/nonints.h    Sun Jul 26 18:11:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.82 2020/07/20 19:53:40 rillig Exp $      */
+/*     $NetBSD: nonints.h,v 1.83 2020/07/26 18:11:12 rillig Exp $      */
 
 /*-
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -181,12 +181,9 @@
 typedef enum {
     /* Treat undefined variables as errors. */
     VARE_UNDEFERR      = 0x01,
-    /* Actually evaluate the text, fully expanding variables.
-     * Without this flag, the text is only parsed but not evaluated. */
+    /* Expand and evaluate variables during parsing. */
     VARE_WANTRES       = 0x02,
-    VARE_ASSIGN                = 0x04,
-    /* Return the literal text, without expanding variables. */
-    VARE_NOSUBST       = 0x08
+    VARE_ASSIGN                = 0x04
 } VarEvalFlags;
 
 void Var_Delete(const char *, GNode *);
diff -r 862fda7f8434 -r ab530aded5f6 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Jul 26 18:10:00 2020 +0000
+++ b/usr.bin/make/var.c        Sun Jul 26 18:11:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.322 2020/07/26 17:44:54 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.323 2020/07/26 18:11:12 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1834,7 +1834,7 @@
                else
                    Buf_AddByte(&buf, *cp);
            } else {
-               if (!(eflags & VARE_NOSUBST)) {
+               if (eflags & VARE_WANTRES) {
                    char   *cp2;
                    int     len;
                    void   *freeIt;
@@ -2075,7 +2075,7 @@
     st->cp = mod + 1;
     char delim = '@';
     args.tvar = ParseModifierPart(st->ctxt, &st->cp, delim,
-                                 st->eflags | VARE_NOSUBST,
+                                 st->eflags & ~VARE_WANTRES,
                                  NULL, NULL, NULL);
     if (args.tvar == NULL) {
        st->missing_delim = delim;
@@ -2083,7 +2083,7 @@
     }
 
     args.str = ParseModifierPart(st->ctxt, &st->cp, delim,
-                                st->eflags | VARE_NOSUBST,
+                                st->eflags & ~VARE_WANTRES,
                                 NULL, NULL, NULL);
     if (args.str == NULL) {
        st->missing_delim = delim;
@@ -2857,9 +2857,8 @@
     }
 
     char delim = st->startc == PROPEN ? PRCLOSE : BRCLOSE;
-    VarEvalFlags eflags = (st->eflags & VARE_WANTRES) ? 0 : VARE_NOSUBST;
     char *val = ParseModifierPart(st->ctxt, &st->cp, delim,
-                                 st->eflags | eflags, NULL, NULL, NULL);
+                                 st->eflags, NULL, NULL, NULL);
     if (st->v->flags & VAR_JUNK) {
        /* restore original name */
        free(st->v->name);



Home | Main Index | Thread Index | Old Index