Module Name:    src
Committed By:   rillig
Date:           Wed Jan 27 00:02:38 UTC 2021

Modified Files:
        src/usr.bin/make: parse.c
        src/usr.bin/make/unit-tests: directive-error.exp directive-error.mk
            opt-warnings-as-errors.exp opt-warnings-as-errors.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.532 -r1.533 src/usr.bin/make/parse.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-error.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-error.mk \
    src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk
cvs rdiff -u -r1.3 -r1.4 \
    src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp

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.532 src/usr.bin/make/parse.c:1.533
--- src/usr.bin/make/parse.c:1.532	Tue Jan 26 23:44:56 2021
+++ src/usr.bin/make/parse.c	Wed Jan 27 00:02:38 2021
@@ -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 @@ ParseVErrorInternal(FILE *f, const char 
 
 	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;
 	}

Index: src/usr.bin/make/unit-tests/directive-error.exp
diff -u src/usr.bin/make/unit-tests/directive-error.exp:1.2 src/usr.bin/make/unit-tests/directive-error.exp:1.3
--- src/usr.bin/make/unit-tests/directive-error.exp:1.2	Tue Jan 26 23:51:20 2021
+++ src/usr.bin/make/unit-tests/directive-error.exp	Wed Jan 27 00:02:38 2021
@@ -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

Index: src/usr.bin/make/unit-tests/directive-error.mk
diff -u src/usr.bin/make/unit-tests/directive-error.mk:1.4 src/usr.bin/make/unit-tests/directive-error.mk:1.5
--- src/usr.bin/make/unit-tests/directive-error.mk:1.4	Tue Jan 26 23:51:20 2021
+++ src/usr.bin/make/unit-tests/directive-error.mk	Wed Jan 27 00:02:38 2021
@@ -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
Index: src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk
diff -u src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.4 src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.5
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk:1.4	Mon Nov  9 20:50:56 2020
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.mk	Wed Jan 27 00:02:38 2021
@@ -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
 

Index: src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp
diff -u src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.3 src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.4
--- src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp:1.3	Mon Nov  9 20:50:56 2020
+++ src/usr.bin/make/unit-tests/opt-warnings-as-errors.exp	Wed Jan 27 00:02:38 2021
@@ -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

Reply via email to