Module Name: src
Committed By: rillig
Date: Tue Jan 3 00:00:46 UTC 2023
Modified Files:
src/usr.bin/make: parse.c
src/usr.bin/make/unit-tests: deptgt.exp deptgt.mk
Log Message:
make: add more details to warning 'Extra targets ignored'
Seen in binutils/zlib/Makefile.in:1283, which defines both '.MAKE' and
'.PHONY' in the same line.
To generate a diff of this commit:
cvs rdiff -u -r1.689 -r1.690 src/usr.bin/make/parse.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/deptgt.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/deptgt.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/parse.c
diff -u src/usr.bin/make/parse.c:1.689 src/usr.bin/make/parse.c:1.690
--- src/usr.bin/make/parse.c:1.689 Sat Oct 1 09:25:06 2022
+++ src/usr.bin/make/parse.c Tue Jan 3 00:00:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.689 2022/10/01 09:25:06 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.690 2023/01/03 00:00:45 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.689 2022/10/01 09:25:06 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.690 2023/01/03 00:00:45 rillig Exp $");
/*
* A file being read.
@@ -1072,8 +1072,12 @@ SkipExtraTargets(char **pp, const char *
warning = true;
p++;
}
- if (warning)
- Parse_Error(PARSE_WARNING, "Extra target ignored");
+ if (warning) {
+ const char *start = *pp;
+ cpp_skip_whitespace(&start);
+ Parse_Error(PARSE_WARNING, "Extra target '%.*s' ignored",
+ (int)(p - start), start);
+ }
*pp += p - *pp;
}
Index: src/usr.bin/make/unit-tests/deptgt.exp
diff -u src/usr.bin/make/unit-tests/deptgt.exp:1.10 src/usr.bin/make/unit-tests/deptgt.exp:1.11
--- src/usr.bin/make/unit-tests/deptgt.exp:1.10 Tue Dec 28 15:49:00 2021
+++ src/usr.bin/make/unit-tests/deptgt.exp Tue Jan 3 00:00:45 2023
@@ -1,4 +1,4 @@
-make: "deptgt.mk" line 10: warning: Extra target ignored
+make: "deptgt.mk" line 10: warning: Extra target '.PHONY' ignored
make: "deptgt.mk" line 28: Unassociated shell command ": command3 # parse error, since targets == NULL"
Parsing line 34: ${:U}: empty-source
ParseDependency(: empty-source)
@@ -9,7 +9,7 @@ Parsing line 37: : command for empty ta
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
+make: "deptgt.mk" line 49: warning: Extra target 'ordinary' ignored
make: "deptgt.mk" line 52: warning: Extra target (ordinary) ignored
make: "deptgt.mk" line 55: warning: Special and mundane targets don't mix. Mundane ones ignored
make: Fatal errors encountered -- cannot continue
Index: src/usr.bin/make/unit-tests/deptgt.mk
diff -u src/usr.bin/make/unit-tests/deptgt.mk:1.12 src/usr.bin/make/unit-tests/deptgt.mk:1.13
--- src/usr.bin/make/unit-tests/deptgt.mk:1.12 Mon Dec 13 23:38:54 2021
+++ src/usr.bin/make/unit-tests/deptgt.mk Tue Jan 3 00:00:45 2023
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt.mk,v 1.12 2021/12/13 23:38:54 rillig Exp $
+# $NetBSD: deptgt.mk,v 1.13 2023/01/03 00:00:45 rillig Exp $
#
# Tests for special targets like .BEGIN or .SUFFIXES in dependency
# declarations.
@@ -45,7 +45,7 @@ ${:U}: empty-source
# that nobody uses it.
$$$$$$$${:U:Z}:
-# expect+1: warning: Extra target ignored
+# expect+1: warning: Extra target 'ordinary' ignored
.END ordinary:
# expect+1: warning: Extra target (ordinary) ignored