Wed Jan 27 00:02:38 2021 UTC ()
make(1): fix irrelevant message in -W mode
(rillig)
diff -r1.532 -r1.533 src/usr.bin/make/parse.c
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-error.exp
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-error.mk
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk
diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
--- src/usr.bin/make/parse.c 2021/01/26 23:44:56 1.532
+++ src/usr.bin/make/parse.c 2021/01/27 00:02:38 1.533
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.532 2021/01/26 23:44:56 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.533 2021/01/27 00:02:38 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.532 2021/01/26 23:44:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.533 2021/01/27 00:02:38 rillig Exp $");
/* types and constants */
@@ -611,13 +611,10 @@
if (type == PARSE_INFO)
goto print_stack_trace;
- if (type == PARSE_FATAL || opts.parseWarnFatal)
- fatals++;
- if (opts.parseWarnFatal && !fatal_warning_error_printed) {
- /*
- * FIXME: Also gets printed on .error, even though it
- * doesn't apply to it.
- */
+ if (type == PARSE_WARNING && !opts.parseWarnFatal)
+ goto print_stack_trace;
+ fatals++;
+ if (type == PARSE_WARNING && !fatal_warning_error_printed) {
Error("parsing warnings being treated as errors");
fatal_warning_error_printed = TRUE;
}
--- src/usr.bin/make/unit-tests/directive-error.exp 2021/01/26 23:51:20 1.2
+++ src/usr.bin/make/unit-tests/directive-error.exp 2021/01/27 00:02:38 1.3
@@ -1,5 +1,4 @@
-make: "directive-error.mk" line 11: message
-make: parsing warnings being treated as errors
+make: "directive-error.mk" line 13: message
make: stopped in unit-tests
exit status 1
--- src/usr.bin/make/unit-tests/directive-error.mk 2021/01/26 23:51:20 1.4
+++ src/usr.bin/make/unit-tests/directive-error.mk 2021/01/27 00:02:38 1.5
@@ -1,11 +1,13 @@
-# $NetBSD: directive-error.mk,v 1.4 2021/01/26 23:51:20 rillig Exp $
+# $NetBSD: directive-error.mk,v 1.5 2021/01/27 00:02:38 rillig Exp $
#
# Tests for the .error directive, which prints an error message and exits
# immediately, unlike other "fatal" parse errors, which continue to parse
# until the end of the current top-level makefile.
+#
+# See also:
+# opt-warnings-as-errors.mk
-# TODO: Implementation
-
-# FIXME: The "parsing warnings being treated as errors" is irrelevant.
+# Before parse.c 1.532 from 2021-01-27, the ".error" issued an irrelevant
+# message saying "parsing warnings being treated as errors".
.MAKEFLAGS: -W
.error message
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk 2020/11/09 20:50:56 1.4
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk 2021/01/27 00:02:38 1.5
@@ -1,6 +1,11 @@
-# $NetBSD: opt-warnings-as-errors.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
+# $NetBSD: opt-warnings-as-errors.mk,v 1.5 2021/01/27 00:02:38 rillig Exp $
#
# Tests for the -W command line option, which turns warnings into errors.
+#
+# Even in -W mode, a .warning is not completely equivalent to an .error.
+# First, the word "warning" is still printed, and second, parsing continues
+# after a failed warning, whereas it would stop immediately at the first
+# .error.
.MAKEFLAGS: -W
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp 2020/11/09 20:50:56 1.3
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp 2021/01/27 00:02:38 1.4
@@ -1,6 +1,6 @@
-make: "opt-warnings-as-errors.mk" line 7: warning: message 1
+make: "opt-warnings-as-errors.mk" line 12: warning: message 1
make: parsing warnings being treated as errors
-make: "opt-warnings-as-errors.mk" line 8: warning: message 2
+make: "opt-warnings-as-errors.mk" line 13: warning: message 2
parsing continues
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests