Module Name:    src
Committed By:   rillig
Date:           Wed Jan 19 22:10:41 UTC 2022

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile dep-wildcards.exp
Added Files:
        src/usr.bin/make/unit-tests: dep-duplicate.exp dep-duplicate.mk

Log Message:
tests/make: demonstrate wrong location in diagnostic (since 2018-12-22)

When a target has multiple places where commands are defined, the
diagnostics mixed up the filename in some cases.


To generate a diff of this commit:
cvs rdiff -u -r1.1181 -r1.1182 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.295 -r1.296 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/dep-duplicate.exp \
    src/usr.bin/make/unit-tests/dep-duplicate.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/dep-wildcards.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1181 src/distrib/sets/lists/tests/mi:1.1182
--- src/distrib/sets/lists/tests/mi:1.1181	Tue Dec 28 00:56:16 2021
+++ src/distrib/sets/lists/tests/mi	Wed Jan 19 22:10:41 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1181 2021/12/28 00:56:16 rillig Exp $
+# $NetBSD: mi,v 1.1182 2022/01/19 22:10:41 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5455,6 +5455,8 @@
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-duplicate.exp				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-duplicate.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-exclam.mk				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/dep-none.exp				tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.295 src/usr.bin/make/unit-tests/Makefile:1.296
--- src/usr.bin/make/unit-tests/Makefile:1.295	Tue Jan 11 19:47:34 2022
+++ src/usr.bin/make/unit-tests/Makefile	Wed Jan 19 22:10:41 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.295 2022/01/11 19:47:34 rillig Exp $
+# $NetBSD: Makefile,v 1.296 2022/01/19 22:10:41 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -92,6 +92,7 @@ TESTS+=		dep-colon
 TESTS+=		dep-colon-bug-cross-file
 TESTS+=		dep-double-colon
 TESTS+=		dep-double-colon-indep
+TESTS+=		dep-duplicate
 TESTS+=		dep-exclam
 TESTS+=		dep-none
 TESTS+=		dep-op-missing

Index: src/usr.bin/make/unit-tests/dep-wildcards.exp
diff -u src/usr.bin/make/unit-tests/dep-wildcards.exp:1.6 src/usr.bin/make/unit-tests/dep-wildcards.exp:1.7
--- src/usr.bin/make/unit-tests/dep-wildcards.exp:1.6	Tue Dec 14 00:02:57 2021
+++ src/usr.bin/make/unit-tests/dep-wildcards.exp	Wed Jan 19 22:10:41 2022
@@ -2,6 +2,7 @@ dep-colon-bug-cross-file.mk
 dep-colon.mk
 dep-double-colon-indep.mk
 dep-double-colon.mk
+dep-duplicate.mk
 dep-exclam.mk
 dep-none.mk
 dep-op-missing.mk

Added files:

Index: src/usr.bin/make/unit-tests/dep-duplicate.exp
diff -u /dev/null src/usr.bin/make/unit-tests/dep-duplicate.exp:1.1
--- /dev/null	Wed Jan 19 22:10:41 2022
+++ src/usr.bin/make/unit-tests/dep-duplicate.exp	Wed Jan 19 22:10:41 2022
@@ -0,0 +1,4 @@
+make: "dep-duplicate.inc" line 1: warning: duplicate script for target "all" ignored
+make: "dep-duplicate.inc" line 15: warning: using previous script for "all" defined here
+first
+exit status 0
Index: src/usr.bin/make/unit-tests/dep-duplicate.mk
diff -u /dev/null src/usr.bin/make/unit-tests/dep-duplicate.mk:1.1
--- /dev/null	Wed Jan 19 22:10:41 2022
+++ src/usr.bin/make/unit-tests/dep-duplicate.mk	Wed Jan 19 22:10:41 2022
@@ -0,0 +1,21 @@
+# $NetBSD: dep-duplicate.mk,v 1.1 2022/01/19 22:10:41 rillig Exp $
+#
+# Test for a target whose commands are defined twice.  This generates a
+# warning, not an error, so ensure that the correct commands are kept.
+#
+# Also ensure that the diagnostics mention the correct file in case of
+# included files.  This particular case had been broken in parse.c 1.231 from
+# 2018-12-22.
+
+# expect: make: "dep-duplicate.inc" line 15: warning: using previous script for "all" defined here
+# FIXME: The file "dep-duplicate.inc" has no line 15.
+
+# expect: first
+all: .PHONY
+	@echo first
+
+_!=	echo 'all:;echo second' > dep-duplicate.inc
+.include "${.CURDIR}/dep-duplicate.inc"
+
+.END:
+	@rm -f dep-duplicate.inc

Reply via email to