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: omit unnecessary details from -dv debug log



details:   https://anonhg.NetBSD.org/src/rev/db071b07a6e7
branches:  trunk
changeset: 961000:db071b07a6e7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Apr 05 13:27:30 2021 +0000

description:
make: omit unnecessary details from -dv debug log

When an expression is based on a defined variable, it does not matter
whether the evaluation mode is "eval" or "eval-defined", therefore omit
these details to reduce confusion.

diffstat:

 usr.bin/make/unit-tests/directive-export-impl.exp  |  12 ++++++------
 usr.bin/make/unit-tests/directive-unexport-env.exp |   4 ++--
 usr.bin/make/unit-tests/vardebug.exp               |  14 +++++++-------
 usr.bin/make/unit-tests/varmod-assign.exp          |   2 +-
 usr.bin/make/unit-tests/varmod-match-escape.exp    |   8 ++++----
 usr.bin/make/var.c                                 |  16 ++++++++++++----
 6 files changed, 32 insertions(+), 24 deletions(-)

diffs (192 lines):

diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/unit-tests/directive-export-impl.exp
--- a/usr.bin/make/unit-tests/directive-export-impl.exp Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-export-impl.exp Mon Apr 05 13:27:30 2021 +0000
@@ -5,7 +5,7 @@
 ParseReadLine (32): ': ${UT_VAR:N*}'
 Var_Parse: ${UT_VAR:N*} (eval-defined)
 Var_Parse: ${REF}> (eval-defined)
-Evaluating modifier ${UT_VAR:N...} on value "<>" (eval-defined, regular)
+Evaluating modifier ${UT_VAR:N...} on value "<>"
 Pattern for ':N' is "*"
 ModifyWords: split "<>" into 1 words
 Result of ${UT_VAR:N*} is "" (eval-defined, regular)
@@ -15,9 +15,9 @@
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
 Modifier part: "echo "$UT_VAR""
 Var_Parse: ${.MAKE.EXPORTED:O:u} (eval)
-Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_VAR" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_VAR"
 Result of ${.MAKE.EXPORTED:O} is "UT_VAR" (eval, regular)
-Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_VAR" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_VAR"
 Result of ${.MAKE.EXPORTED:u} is "UT_VAR" (eval, regular)
 Var_Parse: ${UT_VAR} (eval)
 Var_Parse: ${REF}> (eval)
@@ -26,7 +26,7 @@
 ParseReadLine (50): ': ${UT_VAR:N*}'
 Var_Parse: ${UT_VAR:N*} (eval-defined)
 Var_Parse: ${REF}> (eval-defined)
-Evaluating modifier ${UT_VAR:N...} on value "<>" (eval-defined, regular)
+Evaluating modifier ${UT_VAR:N...} on value "<>"
 Pattern for ':N' is "*"
 ModifyWords: split "<>" into 1 words
 Result of ${UT_VAR:N*} is "" (eval-defined, regular)
@@ -38,9 +38,9 @@
 Evaluating modifier ${:!...} on value "" (eval-defined, undefined)
 Modifier part: "echo "$UT_VAR""
 Var_Parse: ${.MAKE.EXPORTED:O:u} (eval)
-Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_VAR" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_VAR"
 Result of ${.MAKE.EXPORTED:O} is "UT_VAR" (eval, regular)
-Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_VAR" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_VAR"
 Result of ${.MAKE.EXPORTED:u} is "UT_VAR" (eval, regular)
 Var_Parse: ${UT_VAR} (eval)
 Var_Parse: ${REF}> (eval)
diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/unit-tests/directive-unexport-env.exp
--- a/usr.bin/make/unit-tests/directive-unexport-env.exp        Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-unexport-env.exp        Mon Apr 05 13:27:30 2021 +0000
@@ -5,9 +5,9 @@
 Global:.MAKE.EXPORTED = UT_EXPORTED
 make: "directive-unexport-env.mk" line 21: The directive .unexport-env does not take arguments
 Var_Parse: ${.MAKE.EXPORTED:O:u} (eval)
-Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_EXPORTED" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:O} on value "UT_EXPORTED"
 Result of ${.MAKE.EXPORTED:O} is "UT_EXPORTED" (eval, regular)
-Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_EXPORTED" (eval, regular)
+Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_EXPORTED"
 Result of ${.MAKE.EXPORTED:u} is "UT_EXPORTED" (eval, regular)
 Unexporting "UT_EXPORTED"
 Global:delete .MAKE.EXPORTED
diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/unit-tests/vardebug.exp
--- a/usr.bin/make/unit-tests/vardebug.exp      Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/unit-tests/vardebug.exp      Mon Apr 05 13:27:30 2021 +0000
@@ -18,30 +18,30 @@
 Global:VAR = 1 2
 Global:VAR = 1 2 3
 Var_Parse: ${VAR:M[2]} (eval-defined)
-Evaluating modifier ${VAR:M...} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:M...} on value "1 2 3"
 Pattern for ':M' is "[2]"
 ModifyWords: split "1 2 3" into 3 words
 Result of ${VAR:M[2]} is "2" (eval-defined, regular)
 Var_Parse: ${VAR:N[2]} (eval-defined)
-Evaluating modifier ${VAR:N...} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:N...} on value "1 2 3"
 Pattern for ':N' is "[2]"
 ModifyWords: split "1 2 3" into 3 words
 Result of ${VAR:N[2]} is "1 3" (eval-defined, regular)
 Var_Parse: ${VAR:S,2,two,} (eval-defined)
-Evaluating modifier ${VAR:S...} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:S...} on value "1 2 3"
 Modifier part: "2"
 Modifier part: "two"
 ModifyWords: split "1 2 3" into 3 words
 Result of ${VAR:S,2,two,} is "1 two 3" (eval-defined, regular)
 Var_Parse: ${VAR:Q} (eval-defined)
-Evaluating modifier ${VAR:Q} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:Q} on value "1 2 3"
 Result of ${VAR:Q} is "1\ 2\ 3" (eval-defined, regular)
 Var_Parse: ${VAR:tu:tl:Q} (eval-defined)
-Evaluating modifier ${VAR:t...} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:t...} on value "1 2 3"
 Result of ${VAR:tu} is "1 2 3" (eval-defined, regular)
-Evaluating modifier ${VAR:t...} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:t...} on value "1 2 3"
 Result of ${VAR:tl} is "1 2 3" (eval-defined, regular)
-Evaluating modifier ${VAR:Q} on value "1 2 3" (eval-defined, regular)
+Evaluating modifier ${VAR:Q} on value "1 2 3"
 Result of ${VAR:Q} is "1\ 2\ 3" (eval-defined, regular)
 Var_Parse: ${:Uvalue:${:UM*e}:Mvalu[e]} (eval-defined)
 Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/unit-tests/varmod-assign.exp
--- a/usr.bin/make/unit-tests/varmod-assign.exp Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-assign.exp Mon Apr 05 13:27:30 2021 +0000
@@ -4,7 +4,7 @@
 Global:VAR.${param} = initial-value
 Var_Parse: ${${VARNAME}::=assigned-value} (eval-defined)
 Var_Parse: ${VARNAME}::=assigned-value} (eval-defined)
-Evaluating modifier ${VAR.${param}::...} on value "initial-value" (eval-defined, regular)
+Evaluating modifier ${VAR.${param}::...} on value "initial-value"
 Modifier part: "assigned-value"
 Global:VAR.${param} = assigned-value
 Result of ${VAR.${param}::=assigned-value} is "" (eval-defined, regular)
diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/unit-tests/varmod-match-escape.exp
--- a/usr.bin/make/unit-tests/varmod-match-escape.exp   Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-match-escape.exp   Mon Apr 05 13:27:30 2021 +0000
@@ -1,7 +1,7 @@
 Global:SPECIALS = \: : \\ * \*
 CondParser_Eval: ${SPECIALS:M${:U}\:} != ${SPECIALS:M\:${:U}}
 Var_Parse: ${SPECIALS:M${:U}\:} != ${SPECIALS:M\:${:U}} (eval-defined)
-Evaluating modifier ${SPECIALS:M...} on value "\: : \\ * \*" (eval-defined, regular)
+Evaluating modifier ${SPECIALS:M...} on value "\: : \\ * \*"
 Var_Parse: ${:U}\: (eval-defined)
 Evaluating modifier ${:U} on value "" (eval-defined, undefined)
 Result of ${:U} is "" (eval-defined, defined)
@@ -9,7 +9,7 @@
 ModifyWords: split "\: : \\ * \*" into 5 words
 Result of ${SPECIALS:M${:U}\:} is ":" (eval-defined, regular)
 Var_Parse: ${SPECIALS:M\:${:U}} (eval-defined)
-Evaluating modifier ${SPECIALS:M...} on value "\: : \\ * \*" (eval-defined, regular)
+Evaluating modifier ${SPECIALS:M...} on value "\: : \\ * \*"
 Var_Parse: ${:U} (eval-defined)
 Evaluating modifier ${:U} on value "" (eval-defined, undefined)
 Result of ${:U} is "" (eval-defined, defined)
@@ -20,7 +20,7 @@
 Global:VALUES = : :: :\:
 CondParser_Eval: ${VALUES:M\:${:U\:}} != ${VALUES:M${:U\:}\:}
 Var_Parse: ${VALUES:M\:${:U\:}} != ${VALUES:M${:U\:}\:} (eval-defined)
-Evaluating modifier ${VALUES:M...} on value ": :: :\:" (eval-defined, regular)
+Evaluating modifier ${VALUES:M...} on value ": :: :\:"
 Var_Parse: ${:U:} (eval-defined)
 Evaluating modifier ${:U} on value "" (eval-defined, undefined)
 Result of ${:U} is "" (eval-defined, defined)
@@ -28,7 +28,7 @@
 ModifyWords: split ": :: :\:" into 3 words
 Result of ${VALUES:M\:${:U\:}} is ":" (eval-defined, regular)
 Var_Parse: ${VALUES:M${:U\:}\:} (eval-defined)
-Evaluating modifier ${VALUES:M...} on value ": :: :\:" (eval-defined, regular)
+Evaluating modifier ${VALUES:M...} on value ": :: :\:"
 Var_Parse: ${:U\:}\: (eval-defined)
 Evaluating modifier ${:U...} on value "" (eval-defined, undefined)
 Result of ${:U\:} is ":" (eval-defined, defined)
diff -r 5813a6a266c4 -r db071b07a6e7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Apr 05 13:14:54 2021 +0000
+++ b/usr.bin/make/var.c        Mon Apr 05 13:27:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.909 2021/04/05 13:14:54 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.910 2021/04/05 13:27:30 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.909 2021/04/05 13:14:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.910 2021/04/05 13:27:30 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3672,11 +3672,19 @@
                return;
        }
 
+       if ((expr->emode == VARE_WANTRES || expr->emode == VARE_UNDEFERR) &&
+           expr->defined == DEF_REGULAR) {
+               debug_printf(
+                   "Evaluating modifier ${%s:%c%s} on value \"%s\"\n",
+                   expr->name, mod[0], is_single_char ? "" : "...",
+                   expr->value.str);
+               return;
+       }
+
        debug_printf(
            "Evaluating modifier ${%s:%c%s} on value \"%s\" (%s, %s)\n",
            expr->name, mod[0], is_single_char ? "" : "...", expr->value.str,
-           VarEvalMode_Name[expr->emode],
-           ExprDefined_Name[expr->defined]);
+           VarEvalMode_Name[expr->emode], ExprDefined_Name[expr->defined]);
 }
 
 static void



Home | Main Index | Thread Index | Old Index