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(1): fix irrelevant message in -W mode



details:   https://anonhg.NetBSD.org/src/rev/51a9f38b4ca3
branches:  trunk
changeset: 958974:51a9f38b4ca3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jan 27 00:02:38 2021 +0000

description:
make(1): fix irrelevant message in -W mode

diffstat:

 usr.bin/make/parse.c                               |  15 ++++++---------
 usr.bin/make/unit-tests/directive-error.exp        |   3 +--
 usr.bin/make/unit-tests/directive-error.mk         |  10 ++++++----
 usr.bin/make/unit-tests/opt-warnings-as-errors.exp |   4 ++--
 usr.bin/make/unit-tests/opt-warnings-as-errors.mk  |   7 ++++++-
 5 files changed, 21 insertions(+), 18 deletions(-)

diffs (95 lines):

diff -r e2b23ebcd2e3 -r 51a9f38b4ca3 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Tue Jan 26 23:51:20 2021 +0000
+++ b/usr.bin/make/parse.c      Wed Jan 27 00:02:38 2021 +0000
@@ -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;
        }
diff -r e2b23ebcd2e3 -r 51a9f38b4ca3 usr.bin/make/unit-tests/directive-error.exp
--- a/usr.bin/make/unit-tests/directive-error.exp       Tue Jan 26 23:51:20 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-error.exp       Wed Jan 27 00:02:38 2021 +0000
@@ -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
diff -r e2b23ebcd2e3 -r 51a9f38b4ca3 usr.bin/make/unit-tests/directive-error.mk
--- a/usr.bin/make/unit-tests/directive-error.mk        Tue Jan 26 23:51:20 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-error.mk        Wed Jan 27 00:02:38 2021 +0000
@@ -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
diff -r e2b23ebcd2e3 -r 51a9f38b4ca3 usr.bin/make/unit-tests/opt-warnings-as-errors.exp
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.exp        Tue Jan 26 23:51:20 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.exp        Wed Jan 27 00:02:38 2021 +0000
@@ -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
diff -r e2b23ebcd2e3 -r 51a9f38b4ca3 usr.bin/make/unit-tests/opt-warnings-as-errors.mk
--- a/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Tue Jan 26 23:51:20 2021 +0000
+++ b/usr.bin/make/unit-tests/opt-warnings-as-errors.mk Wed Jan 27 00:02:38 2021 +0000
@@ -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
 



Home | Main Index | Thread Index | Old Index