Module Name: src Committed By: rillig Date: Mon Nov 9 00:07:06 UTC 2020
Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-token-plain.mk Log Message: make(1): document handling of '#' and '\n' in conditionals To generate a diff of this commit: cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/cond.c cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-token-plain.mk 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/cond.c diff -u src/usr.bin/make/cond.c:1.197 src/usr.bin/make/cond.c:1.198 --- src/usr.bin/make/cond.c:1.197 Sun Nov 8 23:54:28 2020 +++ src/usr.bin/make/cond.c Mon Nov 9 00:07:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.198 2020/11/09 00:07:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -93,7 +93,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.197 2020/11/08 23:54:28 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.198 2020/11/09 00:07:06 rillig Exp $"); /* * The parsing of conditional expressions is based on this grammar: @@ -860,8 +860,9 @@ CondParser_Token(CondParser *par, Boolea par->p++; return TOK_NOT; - case '#': - case '\n': + case '#': /* XXX: see unit-tests/cond-token-plain.mk */ + case '\n': /* XXX: why should this end the condition? */ + /* Probably obsolete now, from 1993-03-21. */ case '\0': return TOK_EOF; Index: src/usr.bin/make/unit-tests/cond-token-plain.mk diff -u src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4 src/usr.bin/make/unit-tests/cond-token-plain.mk:1.5 --- src/usr.bin/make/unit-tests/cond-token-plain.mk:1.4 Sat Sep 12 17:47:24 2020 +++ src/usr.bin/make/unit-tests/cond-token-plain.mk Mon Nov 9 00:07:06 2020 @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-plain.mk,v 1.4 2020/09/12 17:47:24 rillig Exp $ +# $NetBSD: cond-token-plain.mk,v 1.5 2020/11/09 00:07:06 rillig Exp $ # # Tests for plain tokens (that is, string literals without quotes) # in .if conditions. @@ -31,6 +31,9 @@ # comment handling anymore. The comments are supposed to be stripped off # in a very early parsing phase. # +# See https://gnats.netbsd.org/19596 for example makefiles demonstrating the +# original problems. This workaround is probably not needed anymore. +# # XXX: Missing error message for the malformed condition. The right-hand # side is double-quotes, backslash, backslash. # XXX: It is unexpected that the right-hand side evaluates to a single