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: make debug logging a bit more human-friendly



details:   https://anonhg.NetBSD.org/src/rev/8c62a5d074dd
branches:  trunk
changeset: 1029246:8c62a5d074dd
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Dec 28 15:48:59 2021 +0000

description:
make: make debug logging a bit more human-friendly

The previous log format "ParseReadLine (%d): '%s'" focused on the
implementation, it was not immediately obvious to a casual reader that
the number in parentheses was the line number.  Additionally, having
both a colon and quotes in a log message is uncommon.  The quotes have
been added in parse.c 1.127 from 2007-01-01.

The new log format "Parsing line %d: %s" is meant to be easier readable
by humans.  The quotes are not needed since ParseReadLine always strips
trailing whitespace, leaving no room for ambiguities.  The other log
messages follow common punctuation rules, which makes the beginning of
the line equally unambiguous.  Before var.c 1.911 from 2021-04-05,
variable assignments were logged with the format "%s:%s = %s", without a
space after the colon.

diffstat:

 usr.bin/make/parse.c                              |   6 ++--
 usr.bin/make/unit-tests/deptgt-order.exp          |   4 +-
 usr.bin/make/unit-tests/deptgt.exp                |  10 +++---
 usr.bin/make/unit-tests/directive-export-impl.exp |  14 +++++-----
 usr.bin/make/unit-tests/include-main.exp          |   4 +-
 usr.bin/make/unit-tests/suff-incomplete.exp       |  12 ++++----
 usr.bin/make/unit-tests/suff-main-several.exp     |  30 +++++++++++-----------
 usr.bin/make/unit-tests/suff-rebuild.exp          |  22 ++++++++--------
 usr.bin/make/unit-tests/var-eval-short.exp        |   4 +-
 usr.bin/make/unit-tests/varmod-indirect.exp       |  10 +++---
 usr.bin/make/unit-tests/varmod-loop.exp           |   6 ++--
 usr.bin/make/unit-tests/varname-dot-shell.exp     |  12 ++++----
 12 files changed, 67 insertions(+), 67 deletions(-)

diffs (truncated from 408 to 300 lines):

diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/parse.c      Tue Dec 28 15:48:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.590 2021/12/28 15:03:10 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.591 2021/12/28 15:48:59 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.590 2021/12/28 15:03:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.591 2021/12/28 15:48:59 rillig Exp $");
 
 /* types and constants */
 
@@ -3180,7 +3180,7 @@
 
        do {
                while ((line = ParseReadLine()) != NULL) {
-                       DEBUG2(PARSE, "ParseReadLine (%d): '%s'\n",
+                       DEBUG2(PARSE, "Parsing line %d: %s\n",
                            CurFile()->lineno, line);
                        ParseLine(line);
                }
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/deptgt-order.exp
--- a/usr.bin/make/unit-tests/deptgt-order.exp  Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/deptgt-order.exp  Tue Dec 28 15:48:59 2021 +0000
@@ -1,9 +1,9 @@
-ParseReadLine (15): '.ORDER: three one'
+Parsing line 15: .ORDER: three one
 ParseDependency(.ORDER: three one)
 # ParseDependencySourceOrder: added Order dependency three - one
 # three, unmade, type OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS, flags none
 # one, unmade, type OP_DEPENDS|OP_PHONY, flags none
-ParseReadLine (16): '.MAKEFLAGS: -d0'
+Parsing line 16: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 : 'Making two out of one.'
 : 'Making three out of two.'
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/deptgt.exp
--- a/usr.bin/make/unit-tests/deptgt.exp        Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/deptgt.exp        Tue Dec 28 15:48:59 2021 +0000
@@ -1,12 +1,12 @@
 make: "deptgt.mk" line 10: warning: Extra target ignored
 make: "deptgt.mk" line 28: Unassociated shell command ": command3              # parse error, since targets == NULL"
-ParseReadLine (34): '${:U}: empty-source'
+Parsing line 34: ${:U}: empty-source
 ParseDependency(: empty-source)
-ParseReadLine (35): '  : command for empty targets list'
-ParseReadLine (36): ': empty-source'
+Parsing line 35:       : command for empty targets list
+Parsing line 36: : empty-source
 ParseDependency(: empty-source)
-ParseReadLine (37): '  : command for empty targets list'
-ParseReadLine (38): '.MAKEFLAGS: -d0'
+Parsing line 37:       : command for empty targets list
+Parsing line 38: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 make: "deptgt.mk" line 46: Unknown modifier "Z"
 make: "deptgt.mk" line 49: warning: Extra target ignored
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/directive-export-impl.exp
--- a/usr.bin/make/unit-tests/directive-export-impl.exp Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-export-impl.exp Tue Dec 28 15:48:59 2021 +0000
@@ -1,8 +1,8 @@
-ParseReadLine (21): 'UT_VAR=           <${REF}>'
+Parsing line 21: UT_VAR=               <${REF}>
 Global: UT_VAR = <${REF}>
-ParseReadLine (28): '.export UT_VAR'
+Parsing line 28: .export UT_VAR
 Global: .MAKE.EXPORTED = UT_VAR
-ParseReadLine (32): ': ${UT_VAR:N*}'
+Parsing line 32: : ${UT_VAR:N*}
 Var_Parse: ${UT_VAR:N*} (eval-defined)
 Var_Parse: ${REF}> (eval-defined)
 Evaluating modifier ${UT_VAR:N...} on value "<>"
@@ -23,7 +23,7 @@
 Var_Parse: ${REF}> (eval)
 Result of ${:!echo "\$UT_VAR"!} is "<>" (eval-defined, defined)
 lhs = "<>", rhs = "<>", op = !=
-ParseReadLine (50): ': ${UT_VAR:N*}'
+Parsing line 50: : ${UT_VAR:N*}
 Var_Parse: ${UT_VAR:N*} (eval-defined)
 Var_Parse: ${REF}> (eval-defined)
 Evaluating modifier ${UT_VAR:N...} on value "<>"
@@ -31,7 +31,7 @@
 ModifyWords: split "<>" into 1 word
 Result of ${UT_VAR:N*} is ""
 ParseDependency(: )
-ParseReadLine (54): 'REF=              defined'
+Parsing line 54: REF=          defined
 Global: REF = defined
 CondParser_Eval: ${:!echo "\$UT_VAR"!} != "<defined>"
 Var_Parse: ${:!echo "\$UT_VAR"!} != "<defined>" (eval-defined)
@@ -46,10 +46,10 @@
 Var_Parse: ${REF}> (eval)
 Result of ${:!echo "\$UT_VAR"!} is "<defined>" (eval-defined, defined)
 lhs = "<defined>", rhs = "<defined>", op = !=
-ParseReadLine (62): 'all:'
+Parsing line 62: all:
 ParseDependency(all:)
 Global: .ALLTARGETS =  all
-ParseReadLine (63): '.MAKEFLAGS: -d0'
+Parsing line 63: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 Global: .MAKEFLAGS =  -r -k -d cpv -d
 Global: .MAKEFLAGS =  -r -k -d cpv -d 0
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/include-main.exp
--- a/usr.bin/make/unit-tests/include-main.exp  Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/include-main.exp  Tue Dec 28 15:48:59 2021 +0000
@@ -2,13 +2,13 @@
 make: "include-main.mk" line 21: main-before-for-ok
 make: "include-sub.mk" line 4: sub-before-ok
 make: "include-sub.mk" line 14: sub-before-for-ok
-ParseReadLine (5): '.  info subsub-ok'
+Parsing line 5: .  info subsub-ok
 make: "include-subsub.mk" line 5: subsub-ok
        in .for loop from include-sub.mk:31
        in .for loop from include-sub.mk:30
        in .for loop from include-sub.mk:29
        in .include from include-main.mk:27
-ParseReadLine (6): '.MAKEFLAGS: -d0'
+Parsing line 6: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 make: "include-sub.mk" line 38: sub-after-ok
 make: "include-sub.mk" line 45: sub-after-for-ok
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/suff-incomplete.exp
--- a/usr.bin/make/unit-tests/suff-incomplete.exp       Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/suff-incomplete.exp       Tue Dec 28 15:48:59 2021 +0000
@@ -1,17 +1,17 @@
-ParseReadLine (9): '.SUFFIXES:'
+Parsing line 9: .SUFFIXES:
 ParseDependency(.SUFFIXES:)
 Clearing all suffixes
-ParseReadLine (11): '.SUFFIXES: .a .b .c'
+Parsing line 11: .SUFFIXES: .a .b .c
 ParseDependency(.SUFFIXES: .a .b .c)
 Adding suffix ".a"
 Adding suffix ".b"
 Adding suffix ".c"
-ParseReadLine (17): '.a.b:'
+Parsing line 17: .a.b:
 ParseDependency(.a.b:)
 defining transformation from `.a' to `.b'
 inserting ".a" (1) at end of list
 inserting ".b" (2) at end of list
-ParseReadLine (21): '.a.c: ${.PREFIX}.dependency'
+Parsing line 21: .a.c: ${.PREFIX}.dependency
 deleting incomplete transformation from `.a' to `.b'
 ParseDependency(.a.c: ${.PREFIX}.dependency)
 defining transformation from `.a' to `.c'
@@ -20,10 +20,10 @@
 # LinkSource: added child .a.c - ${.PREFIX}.dependency
 # .a.c, unmade, type OP_DEPENDS|OP_TRANSFORM, flags none
 # ${.PREFIX}.dependency, unmade, type none, flags none
-ParseReadLine (23): '.DEFAULT:'
+Parsing line 23: .DEFAULT:
 transformation .a.c complete
 ParseDependency(.DEFAULT:)
-ParseReadLine (24): '  : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.'
+Parsing line 24:       : Making ${.TARGET} from ${.IMPSRC} all ${.ALLSRC} by default.
 transformation .DEFAULT complete
 Wildcard expanding "all"...
 SuffFindDeps "all"
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/suff-main-several.exp
--- a/usr.bin/make/unit-tests/suff-main-several.exp     Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/suff-main-several.exp     Tue Dec 28 15:48:59 2021 +0000
@@ -1,11 +1,11 @@
-ParseReadLine (8): '.1.2 .1.3 .1.4:'
+Parsing line 8: .1.2 .1.3 .1.4:
 ParseDependency(.1.2 .1.3 .1.4:)
 Setting main node to ".1.2"
-ParseReadLine (9): '   : Making ${.TARGET} from ${.IMPSRC}.'
-ParseReadLine (14): 'next-main:'
+Parsing line 9:        : Making ${.TARGET} from ${.IMPSRC}.
+Parsing line 14: next-main:
 ParseDependency(next-main:)
-ParseReadLine (15): '  : Making ${.TARGET}'
-ParseReadLine (19): '.SUFFIXES: .1 .2 .3 .4'
+Parsing line 15:       : Making ${.TARGET}
+Parsing line 19: .SUFFIXES: .1 .2 .3 .4
 ParseDependency(.SUFFIXES: .1 .2 .3 .4)
 Adding suffix ".1"
 Adding suffix ".2"
@@ -26,42 +26,42 @@
 inserting ".1" (1) at end of list
 inserting ".4" (4) at end of list
 Setting main node to "next-main"
-ParseReadLine (24): '.SUFFIXES:'
+Parsing line 24: .SUFFIXES:
 ParseDependency(.SUFFIXES:)
 Clearing all suffixes
-ParseReadLine (32): '.SUFFIXES: .4 .3 .2 .1'
+Parsing line 32: .SUFFIXES: .4 .3 .2 .1
 ParseDependency(.SUFFIXES: .4 .3 .2 .1)
 Adding suffix ".4"
 Adding suffix ".3"
 Adding suffix ".2"
 Adding suffix ".1"
-ParseReadLine (33): '.SUFFIXES:'
+Parsing line 33: .SUFFIXES:
 ParseDependency(.SUFFIXES:)
 Clearing all suffixes
-ParseReadLine (34): '.SUFFIXES: .1 .2 .3 .4'
+Parsing line 34: .SUFFIXES: .1 .2 .3 .4
 ParseDependency(.SUFFIXES: .1 .2 .3 .4)
 Adding suffix ".1"
 Adding suffix ".2"
 Adding suffix ".3"
 Adding suffix ".4"
-ParseReadLine (35): '.SUFFIXES:'
+Parsing line 35: .SUFFIXES:
 ParseDependency(.SUFFIXES:)
 Clearing all suffixes
-ParseReadLine (36): '.SUFFIXES: .4 .3 .2 .1'
+Parsing line 36: .SUFFIXES: .4 .3 .2 .1
 ParseDependency(.SUFFIXES: .4 .3 .2 .1)
 Adding suffix ".4"
 Adding suffix ".3"
 Adding suffix ".2"
 Adding suffix ".1"
-ParseReadLine (38): 'suff-main-several.1:'
+Parsing line 38: suff-main-several.1:
 ParseDependency(suff-main-several.1:)
-ParseReadLine (39): '  : Making ${.TARGET} out of nothing.'
-ParseReadLine (40): 'next-main: suff-main-several.{2,3,4}'
+Parsing line 39:       : Making ${.TARGET} out of nothing.
+Parsing line 40: next-main: suff-main-several.{2,3,4}
 ParseDependency(next-main: suff-main-several.{2,3,4})
 # LinkSource: added child next-main - suff-main-several.{2,3,4}
 # next-main, unmade, type OP_DEPENDS|OP_HAS_COMMANDS, flags none
 # suff-main-several.{2,3,4}, unmade, type none, flags none
-ParseReadLine (42): '.MAKEFLAGS: -d0 -dg1'
+Parsing line 42: .MAKEFLAGS: -d0 -dg1
 ParseDependency(.MAKEFLAGS: -d0 -dg1)
 #*** Input graph:
 # .1.2, unmade, type OP_TRANSFORM, flags none
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/suff-rebuild.exp
--- a/usr.bin/make/unit-tests/suff-rebuild.exp  Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/suff-rebuild.exp  Tue Dec 28 15:48:59 2021 +0000
@@ -1,36 +1,36 @@
-ParseReadLine (10): '.SUFFIXES:'
+Parsing line 10: .SUFFIXES:
 ParseDependency(.SUFFIXES:)
 Clearing all suffixes
-ParseReadLine (12): '.SUFFIXES: .a .b .c'
+Parsing line 12: .SUFFIXES: .a .b .c
 ParseDependency(.SUFFIXES: .a .b .c)
 Adding suffix ".a"
 Adding suffix ".b"
 Adding suffix ".c"
-ParseReadLine (14): 'suff-rebuild-example.a:'
+Parsing line 14: suff-rebuild-example.a:
 ParseDependency(suff-rebuild-example.a:)
 Adding "suff-rebuild-example.a" to all targets.
-ParseReadLine (15): '  : Making ${.TARGET} out of nothing.'
-ParseReadLine (17): '.a.b:'
+Parsing line 15:       : Making ${.TARGET} out of nothing.
+Parsing line 17: .a.b:
 ParseDependency(.a.b:)
 defining transformation from `.a' to `.b'
 inserting ".a" (1) at end of list
 inserting ".b" (2) at end of list
-ParseReadLine (18): '  : Making ${.TARGET} from ${.IMPSRC}.'
-ParseReadLine (19): '.b.c:'
+Parsing line 18:       : Making ${.TARGET} from ${.IMPSRC}.
+Parsing line 19: .b.c:
 transformation .a.b complete
 ParseDependency(.b.c:)
 defining transformation from `.b' to `.c'
 inserting ".b" (2) at end of list
 inserting ".c" (3) at end of list
-ParseReadLine (20): '  : Making ${.TARGET} from ${.IMPSRC}.'
-ParseReadLine (21): '.c:'
+Parsing line 20:       : Making ${.TARGET} from ${.IMPSRC}.
+Parsing line 21: .c:
 transformation .b.c complete
 ParseDependency(.c:)
 defining transformation from `.c' to `'
 inserting ".c" (3) at end of list
 inserting "" (0) at end of list
-ParseReadLine (22): '  : Making ${.TARGET} from ${.IMPSRC}.'
-ParseReadLine (44): '.SUFFIXES: .c .b .a'
+Parsing line 22:       : Making ${.TARGET} from ${.IMPSRC}.
+Parsing line 44: .SUFFIXES: .c .b .a
 transformation .c complete
 ParseDependency(.SUFFIXES: .c .b .a)
 Adding ".END" to all targets.
diff -r a98dfbf80ef0 -r 8c62a5d074dd usr.bin/make/unit-tests/var-eval-short.exp
--- a/usr.bin/make/unit-tests/var-eval-short.exp        Tue Dec 28 15:03:10 2021 +0000
+++ b/usr.bin/make/unit-tests/var-eval-short.exp        Tue Dec 28 15:48:59 2021 +0000
@@ -10,7 +10,7 @@
 Modifier part: "${FAIL}then"
 Modifier part: "${FAIL}else"
 Result of ${0:?${FAIL}then:${FAIL}else} is "" (parse-only, defined)
-ParseReadLine (163): 'DEFINED= defined'
+Parsing line 163: DEFINED=     defined
 Global: DEFINED = defined



Home | Main Index | Thread Index | Old Index