Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified)) by mollari.NetBSD.org (Postfix) with ESMTPS id CAAC61A921F for ; Wed, 4 Nov 2020 04:24:59 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id 369B884DB6; Wed, 4 Nov 2020 04:24:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id AEC3B84DAF for ; Wed, 4 Nov 2020 04:24:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id uFC3Ug73s5Sq for ; Wed, 4 Nov 2020 04:24:58 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 05C2384D27 for ; Wed, 4 Nov 2020 04:24:58 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id F212DFB28; Wed, 4 Nov 2020 04:24:57 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Wed, 4 Nov 2020 04:24:57 +0000 From: "Roland Illig" Subject: CVS commit: src To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20201104042457.F212DFB28@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Roland Illig" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: rillig Date: Wed Nov 4 04:24:57 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make: var.c src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: cmdline-undefined.exp cmdline-undefined.mk Log Message: make(1): add test for undefined variables in command line arguments The variable discardUndefined has an implicit negation in its name, which makes it hard to understand. Plus, most of the time it is true. It's better to have a flag that is false most of the time and has a positive name. On the first attempt of inverting that variable, I stumbled upon MainParseArgs, which initially leaves discardUndefined == FALSE, and after handling the dashed options, sets it to TRUE. This would make a difference when more command line arguments would be added later via the .MAKEFLAGS special target. Upon further inspection, the only place where discardUndefined is used is in VarAssign_EvalSubst in parse.c, and that place is not reachable from any of the dashed options. Therefore, discardUndefined could already be set at the very beginning of MainParseArgs or even when initializing the global variable itself, without any observable difference. Not even the ::= variable modifier could do anything about this since it is not reachable from the dashed command line options as well, and in addition, it expands its right-hand side in any case, always discarding undefined variables. Oh, these little inconsistencies everywhere. To generate a diff of this commit: cvs rdiff -u -r1.960 -r1.961 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.655 -r1.656 src/usr.bin/make/var.c cvs rdiff -u -r1.187 -r1.188 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmdline-undefined.exp \ src/usr.bin/make/unit-tests/cmdline-undefined.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.