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: separate parsing and evaluating for modif...



details:   https://anonhg.NetBSD.org/src/rev/3f3e73763483
branches:  trunk
changeset: 981557:3f3e73763483
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 20:12:16 2021 +0000

description:
make: separate parsing and evaluating for modifier '::='

No functional change.

diffstat:

 usr.bin/make/var.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (59 lines):

diff -r b49306cd175a -r 3f3e73763483 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 20:09:26 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 20:12:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.880 2021/03/14 20:09:26 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.881 2021/03/14 20:12:16 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.880 2021/03/14 20:09:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.881 2021/03/14 20:12:16 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -3372,8 +3372,6 @@
        char *val;
        VarParseResult res;
 
-       /* TODO: separate parsing from evaluating */
-
        const char *mod = *pp;
        const char *op = mod + 1;
 
@@ -3389,15 +3387,6 @@
                return AMR_BAD;
        }
 
-       scope = expr->scope;    /* scope where v belongs */
-       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;
-               else
-                       VarFreeEnv(gv);
-       }
-
        switch (op[0]) {
        case '+':
        case '?':
@@ -3415,6 +3404,15 @@
 
        (*pp)--;                /* Go back to the st->endc. */
 
+       scope = expr->scope;    /* scope where v belongs */
+       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;
+               else
+                       VarFreeEnv(gv);
+       }
+
        /* XXX: Expanding the variable name at this point sounds wrong. */
        if (expr->eflags & VARE_WANTRES) {
                switch (op[0]) {



Home | Main Index | Thread Index | Old Index