Module Name: src Committed By: rillig Date: Sat Dec 19 12:40:01 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: directive-for-lines.exp directive-for-lines.mk directive-info.exp directive-info.mk Log Message: make(1): add test for backslash continuation lines in .for loops This ensures that the line numbers for messages are the expected onces in .for loops. While experimenting with the backslash continuation lines, I noticed that the reported line numbers for these are based on the number of completely parsed physical lines, which nicely cancels out the + 1 that has to be added for producing human-readable 1-based line numbers. It would be more correct to report the parse errors on the first affected line. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for-lines.exp \ src/usr.bin/make/unit-tests/directive-for-lines.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-info.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-info.mk 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/unit-tests/directive-for-lines.exp diff -u src/usr.bin/make/unit-tests/directive-for-lines.exp:1.2 src/usr.bin/make/unit-tests/directive-for-lines.exp:1.3 --- src/usr.bin/make/unit-tests/directive-for-lines.exp:1.2 Sat Dec 19 12:24:46 2020 +++ src/usr.bin/make/unit-tests/directive-for-lines.exp Sat Dec 19 12:40:00 2020 @@ -1,9 +1,9 @@ -make: "directive-for-lines.mk" line 18: expect 18 -make: "directive-for-lines.mk" line 18: expect 18 -make: "directive-for-lines.mk" line 24: expect 24 -make: "directive-for-lines.mk" line 18: expect 18 -make: "directive-for-lines.mk" line 18: expect 18 -make: "directive-for-lines.mk" line 24: expect 24 +make: "directive-for-lines.mk" line 23: expect 23 +make: "directive-for-lines.mk" line 23: expect 23 +make: "directive-for-lines.mk" line 30: expect 30 +make: "directive-for-lines.mk" line 23: expect 23 +make: "directive-for-lines.mk" line 23: expect 23 +make: "directive-for-lines.mk" line 30: expect 30 make: no target to make. make: stopped in unit-tests Index: src/usr.bin/make/unit-tests/directive-for-lines.mk diff -u src/usr.bin/make/unit-tests/directive-for-lines.mk:1.2 src/usr.bin/make/unit-tests/directive-for-lines.mk:1.3 --- src/usr.bin/make/unit-tests/directive-for-lines.mk:1.2 Sat Dec 19 12:24:46 2020 +++ src/usr.bin/make/unit-tests/directive-for-lines.mk Sat Dec 19 12:40:00 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-for-lines.mk,v 1.2 2020/12/19 12:24:46 rillig Exp $ +# $NetBSD: directive-for-lines.mk,v 1.3 2020/12/19 12:40:00 rillig Exp $ # # Tests for the line numbers that are reported in .for loops. # @@ -9,18 +9,24 @@ .for outer in a b -# comment +# comment \ +# continued comment .for inner in 1 2 -# comment +# comment \ +# continued comment -.info expect 18 +VAR= \ + multi-line + +.info expect 23 .endfor -# comment +# comment \ +# continued comment -.info expect 24 +.info expect 30 .endfor Index: src/usr.bin/make/unit-tests/directive-info.exp diff -u src/usr.bin/make/unit-tests/directive-info.exp:1.4 src/usr.bin/make/unit-tests/directive-info.exp:1.5 --- src/usr.bin/make/unit-tests/directive-info.exp:1.4 Sun Dec 13 01:07:54 2020 +++ src/usr.bin/make/unit-tests/directive-info.exp Sat Dec 19 12:40:00 2020 @@ -9,6 +9,7 @@ make: "directive-info.mk" line 18: Unkno make: "directive-info.mk" line 19: Unknown directive "info" make: "directive-info.mk" line 22: Unknown directive "info-message" make: "directive-info.mk" line 23: no-target: no-source +make: "directive-info.mk" line 32: expect line 30 for multi-line message make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/directive-info.mk diff -u src/usr.bin/make/unit-tests/directive-info.mk:1.6 src/usr.bin/make/unit-tests/directive-info.mk:1.7 --- src/usr.bin/make/unit-tests/directive-info.mk:1.6 Sun Dec 13 01:10:22 2020 +++ src/usr.bin/make/unit-tests/directive-info.mk Sat Dec 19 12:40:00 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-info.mk,v 1.6 2020/12/13 01:10:22 rillig Exp $ +# $NetBSD: directive-info.mk,v 1.7 2020/12/19 12:40:00 rillig Exp $ # # Tests for the .info directive. @@ -23,5 +23,13 @@ .info no-target: no-source # This is a .info directive, not a dependency. # See directive.mk for more tests of this kind. +# Since at least 2002-01-01, the line number that is used in error messages +# and the .info directives is the number of completely read lines. For the +# following multi-line directive, this means that the reported line number is +# the one of the last line, not the first line. +.info expect line 30 for\ + multi$\ + -line message + all: @:;