Module Name: src Committed By: rillig Date: Sun Apr 14 12:30:48 UTC 2024
Modified Files: src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: directive-export-impl.exp directive-for-escape.exp opt-debug-parse.exp var-eval-short.exp varmod-loop.exp varname-dot-shell.exp Log Message: make: add debug logging for .if and .for lines in -dp mode This helps track down in which line a condition is evaluated. To generate a diff of this commit: cvs rdiff -u -r1.718 -r1.719 src/usr.bin/make/parse.c cvs rdiff -u -r1.17 -r1.18 \ src/usr.bin/make/unit-tests/directive-export-impl.exp cvs rdiff -u -r1.23 -r1.24 \ src/usr.bin/make/unit-tests/directive-for-escape.exp \ src/usr.bin/make/unit-tests/var-eval-short.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/opt-debug-parse.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varmod-loop.exp cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/varname-dot-shell.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.718 src/usr.bin/make/parse.c:1.719 --- src/usr.bin/make/parse.c:1.718 Mon Apr 1 12:26:02 2024 +++ src/usr.bin/make/parse.c Sun Apr 14 12:30:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -105,7 +105,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.718 2024/04/01 12:26:02 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.719 2024/04/14 12:30:47 rillig Exp $"); /* Detects a multiple-inclusion guard in a makefile. */ typedef enum { @@ -2607,6 +2607,7 @@ ReadHighLevelLine(void) if (line == NULL) return NULL; + DEBUG2(PARSE, "Parsing line %u: %s\n", curFile->lineno, line); if (curFile->guardState != GS_NO && ((curFile->guardState == GS_START && line[0] != '.') || curFile->guardState == GS_DONE)) @@ -2929,8 +2930,6 @@ Parse_File(const char *name, int fd) do { while ((line = ReadHighLevelLine()) != NULL) { - DEBUG2(PARSE, "Parsing line %u: %s\n", - CurFile()->lineno, line); ParseLine(line); } } while (ParseEOF()); Index: src/usr.bin/make/unit-tests/directive-export-impl.exp diff -u src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17 src/usr.bin/make/unit-tests/directive-export-impl.exp:1.18 --- src/usr.bin/make/unit-tests/directive-export-impl.exp:1.17 Thu Mar 3 19:36:35 2022 +++ src/usr.bin/make/unit-tests/directive-export-impl.exp Sun Apr 14 12:30:47 2024 @@ -10,6 +10,7 @@ Pattern for ':N' is "*" ModifyWords: split "<>" into 1 word Result of ${UT_VAR:N*} is "" ParseDependency(: ) +Parsing line 42: .if ${:!echo "\$UT_VAR"!} != "<>" CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<>" Var_Parse: ${:!echo "\$UT_VAR"!} != "<>" (eval-defined) Evaluating modifier ${:!...} on value "" (eval-defined, undefined) @@ -34,6 +35,7 @@ Result of ${UT_VAR:N*} is "" ParseDependency(: ) Parsing line 54: REF= defined Global: REF = defined +Parsing line 58: .if ${:!echo "\$UT_VAR"!} != "<defined>" CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<defined>" Var_Parse: ${:!echo "\$UT_VAR"!} != "<defined>" (eval-defined) Evaluating modifier ${:!...} on value "" (eval-defined, undefined) Index: src/usr.bin/make/unit-tests/directive-for-escape.exp diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.24 --- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.23 Sun Nov 19 22:06:15 2023 +++ src/usr.bin/make/unit-tests/directive-for-escape.exp Sun Apr 14 12:30:47 2024 @@ -106,6 +106,7 @@ make: "directive-for-escape.mk" line 228 For: end for 1 For: loop body with i = " ": +Parsing line 244: .for i in "${.newline}" For: end for 1 Parse_PushInput: .for loop in directive-for-escape.mk, line 244 make: "directive-for-escape.mk" line 244: newline in .for value Index: src/usr.bin/make/unit-tests/var-eval-short.exp diff -u src/usr.bin/make/unit-tests/var-eval-short.exp:1.23 src/usr.bin/make/unit-tests/var-eval-short.exp:1.24 --- src/usr.bin/make/unit-tests/var-eval-short.exp:1.23 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/var-eval-short.exp Sun Apr 14 12:30:47 2024 @@ -1,5 +1,6 @@ make: "var-eval-short.mk" line 46: In the :@ modifier of "", the variable name "${FAIL}" must not contain a dollar make: "var-eval-short.mk" line 46: Malformed conditional (0 && ${:Uword:@${FAIL}@expr@}) +Parsing line 159: .if 0 && ${0:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${0:?${FAIL}then:${FAIL}else} Var_Parse: ${0:?${FAIL}then:${FAIL}else} (parse-only) Parsing modifier ${0:?...} @@ -10,6 +11,7 @@ Modifier part: "${FAIL}else" Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined) Parsing line 167: DEFINED= defined Global: DEFINED = defined +Parsing line 168: .if 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} CondParser_Eval: 0 && ${DEFINED:L:?${FAIL}then:${FAIL}else} Var_Parse: ${DEFINED:L:?${FAIL}then:${FAIL}else} (parse-only) Parsing modifier ${DEFINED:L} Index: src/usr.bin/make/unit-tests/opt-debug-parse.exp diff -u src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.10 src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.11 --- src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.10 Thu Jun 1 20:56:35 2023 +++ src/usr.bin/make/unit-tests/opt-debug-parse.exp Sun Apr 14 12:30:47 2024 @@ -1,3 +1,4 @@ +Parsing line 16: .for var in value Parse_PushInput: .for loop in opt-debug-parse.mk, line 16 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' Parsing line 21: .info trace with multi-line .for loop head @@ -11,6 +12,7 @@ SetFilenameVars: ${.PARSEDIR} = <some-di SetFilenameVars: ${.INCLUDEDFROMDIR} = <some-dir> ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk' ParseEOF: returning to file opt-debug-parse.mk, line 27 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' +Parsing line 31: .for a b c in 1 2 3 ${:U4 5 6} Parse_PushInput: .for loop in opt-debug-parse.mk, line 31 SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk' Parsing line 34: .info trace Index: src/usr.bin/make/unit-tests/varmod-loop.exp diff -u src/usr.bin/make/unit-tests/varmod-loop.exp:1.19 src/usr.bin/make/unit-tests/varmod-loop.exp:1.20 --- src/usr.bin/make/unit-tests/varmod-loop.exp:1.19 Sat Feb 18 11:55:20 2023 +++ src/usr.bin/make/unit-tests/varmod-loop.exp Sun Apr 14 12:30:48 2024 @@ -1,7 +1,9 @@ Parsing line 91: USE_8_DOLLARS= ${:U1:@var@${8_DOLLARS}@} ${8_DOLLARS} $$$$$$$$ +Parsing line 92: .if ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$" CondParser_Eval: ${USE_8_DOLLARS} != "\$\$\$\$ \$\$\$\$ \$\$\$\$" Comparing "$$$$ $$$$ $$$$" != "$$$$ $$$$ $$$$" Parsing line 96: SUBST_CONTAINING_LOOP:= ${USE_8_DOLLARS} +Parsing line 118: .if ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$" CondParser_Eval: ${SUBST_CONTAINING_LOOP} != "\$\$ \$\$\$\$ \$\$\$\$" Comparing "$$ $$$$ $$$$" != "$$ $$$$ $$$$" Parsing line 121: .MAKEFLAGS: -d0 Index: src/usr.bin/make/unit-tests/varname-dot-shell.exp diff -u src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.20 src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.21 --- src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.20 Wed Dec 20 09:03:09 2023 +++ src/usr.bin/make/unit-tests/varname-dot-shell.exp Sun Apr 14 12:30:48 2024 @@ -6,6 +6,7 @@ Command: .SHELL = (details omitted) Global: ORIG_SHELL = (details omitted) Parsing line 12: .SHELL= overwritten Global: ignoring '.SHELL = overwritten' due to a command line variable of the same name +Parsing line 13: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) @@ -13,6 +14,7 @@ Comparing "(details omitted)" != "(detai Parsing line 19: .MAKEFLAGS: .SHELL+=appended ParseDependency(.MAKEFLAGS: .SHELL+=appended) Command: ignoring '.SHELL += appended' as it is read-only +Parsing line 20: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined) @@ -21,6 +23,7 @@ Parsing line 27: .undef .SHELL Global: ignoring delete '.SHELL' as it is not found Parsing line 28: .SHELL= newly overwritten Global: ignoring '.SHELL = newly overwritten' due to a command line variable of the same name +Parsing line 29: .if ${.SHELL} != ${ORIG_SHELL} CondParser_Eval: ${.SHELL} != ${ORIG_SHELL} Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined) Var_Parse: ${ORIG_SHELL} (eval-defined)