summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-01-03 00:00:45 +0000
committerrillig <rillig@NetBSD.org>2023-01-03 00:00:45 +0000
commita716ecf18d251b593cd8eb24c7e8bd96c7b2d13e (patch)
tree678b5d79df27b7ba4fd917846684c04ea055282b /usr.bin
parent0af55c8603310bd8457941c3865514075985793f (diff)
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/parse.c12
-rw-r--r--usr.bin/make/unit-tests/deptgt.exp4
-rw-r--r--usr.bin/make/unit-tests/deptgt.mk4
3 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 9d4d924173d..7455b7a8a83 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -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 *lstart)
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;
}
diff --git a/usr.bin/make/unit-tests/deptgt.exp b/usr.bin/make/unit-tests/deptgt.exp
index 0a27f562293..73d4a7f0c33 100644
--- a/usr.bin/make/unit-tests/deptgt.exp
+++ b/usr.bin/make/unit-tests/deptgt.exp
@@ -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 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
+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
diff --git a/usr.bin/make/unit-tests/deptgt.mk b/usr.bin/make/unit-tests/deptgt.mk
index 044644dcbd6..7d43220e888 100644
--- a/usr.bin/make/unit-tests/deptgt.mk
+++ b/usr.bin/make/unit-tests/deptgt.mk
@@ -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