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: add more details to warning 'Extra target...



details:   https://anonhg.NetBSD.org/src/rev/f8eb69cac6f1
branches:  trunk
changeset: 372886:f8eb69cac6f1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jan 03 00:00:45 2023 +0000

description:
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:

 usr.bin/make/parse.c               |  12 ++++++++----
 usr.bin/make/unit-tests/deptgt.exp |   4 ++--
 usr.bin/make/unit-tests/deptgt.mk  |   4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 2f7b243cc8de -r f8eb69cac6f1 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Jan 02 20:57:29 2023 +0000
+++ b/usr.bin/make/parse.c      Tue Jan 03 00:00:45 2023 +0000
@@ -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 @@
                        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 -r 2f7b243cc8de -r f8eb69cac6f1 usr.bin/make/unit-tests/deptgt.exp
--- a/usr.bin/make/unit-tests/deptgt.exp        Mon Jan 02 20:57:29 2023 +0000
+++ b/usr.bin/make/unit-tests/deptgt.exp        Tue Jan 03 00:00:45 2023 +0000
@@ -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 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 -r 2f7b243cc8de -r f8eb69cac6f1 usr.bin/make/unit-tests/deptgt.mk
--- a/usr.bin/make/unit-tests/deptgt.mk Mon Jan 02 20:57:29 2023 +0000
+++ b/usr.bin/make/unit-tests/deptgt.mk Tue Jan 03 00:00:45 2023 +0000
@@ -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 @@
 # 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



Home | Main Index | Thread Index | Old Index