Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Feb 2022 05:38:51 GMT
From:      "Simon J. Gerraty" <sjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4eda2649adec - stable/13 - Merge commit 'ee914ef902ae018bd4f67192832120f9bf05651f' into new_merge
Message-ID:  <202202160538.21G5cpXe059594@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=4eda2649adece08245281edc627ebc58c759bedb

commit 4eda2649adece08245281edc627ebc58c759bedb
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2021-06-25 21:31:14 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2022-02-16 05:36:27 +0000

    Merge commit 'ee914ef902ae018bd4f67192832120f9bf05651f' into new_merge
    
    (cherry picked from commit b0c40a00a67f611868fc0f10bde6b28eb75931be)
---
 contrib/bmake/ChangeLog                            |  113 +
 contrib/bmake/FILES                                |   13 +
 contrib/bmake/VERSION                              |    2 +-
 contrib/bmake/arch.c                               |  104 +-
 contrib/bmake/buf.h                                |    4 +-
 contrib/bmake/compat.c                             |   42 +-
 contrib/bmake/cond.c                               |  279 +-
 contrib/bmake/dir.c                                |   62 +-
 contrib/bmake/dir.h                                |    6 +-
 contrib/bmake/enum.h                               |   62 +-
 contrib/bmake/for.c                                |   46 +-
 contrib/bmake/hash.c                               |   68 +-
 contrib/bmake/hash.h                               |   14 +-
 contrib/bmake/import.sh                            |   17 +-
 contrib/bmake/job.c                                |  423 +--
 contrib/bmake/job.h                                |   20 +-
 contrib/bmake/lst.c                                |   10 +-
 contrib/bmake/lst.h                                |   12 +-
 contrib/bmake/main.c                               |  250 +-
 contrib/bmake/make.c                               |   91 +-
 contrib/bmake/make.h                               |  129 +-
 contrib/bmake/meta.c                               |  194 +-
 contrib/bmake/meta.h                               |    8 +-
 contrib/bmake/metachar.h                           |    4 +-
 contrib/bmake/mk/ChangeLog                         |   35 +
 contrib/bmake/mk/dirdeps.mk                        |   76 +-
 contrib/bmake/mk/dpadd.mk                          |    7 +-
 contrib/bmake/mk/install-mk                        |    4 +-
 contrib/bmake/mk/meta.autodep.mk                   |    6 +-
 contrib/bmake/mk/meta2deps.py                      |   54 +-
 contrib/bmake/mk/rst2htm.mk                        |    6 +-
 contrib/bmake/nonints.h                            |  153 +-
 contrib/bmake/parse.c                              |  512 ++--
 contrib/bmake/str.c                                |  101 +-
 contrib/bmake/str.h                                |  366 +++
 contrib/bmake/suff.c                               |   71 +-
 contrib/bmake/targ.c                               |   14 +-
 contrib/bmake/unit-tests/Makefile                  |   28 +-
 contrib/bmake/unit-tests/archive.mk                |    6 +-
 contrib/bmake/unit-tests/cmd-errors-jobs.exp       |    2 +-
 contrib/bmake/unit-tests/cmd-errors-lint.exp       |    2 +-
 contrib/bmake/unit-tests/cmd-errors.exp            |    2 +-
 contrib/bmake/unit-tests/cond-func-empty.mk        |   10 +-
 contrib/bmake/unit-tests/cond-func-make-main.mk    |    6 +-
 contrib/bmake/unit-tests/cond-late.exp             |    2 +-
 contrib/bmake/unit-tests/cond-short.mk             |   14 +-
 contrib/bmake/unit-tests/cond-token-string.exp     |    2 +-
 contrib/bmake/unit-tests/cond-token-var.mk         |   23 +-
 contrib/bmake/unit-tests/cond1.exp                 |    2 +-
 contrib/bmake/unit-tests/counter-append.mk         |    4 +-
 contrib/bmake/unit-tests/counter.mk                |    4 +-
 contrib/bmake/unit-tests/dep-var.mk                |    4 +-
 contrib/bmake/unit-tests/deptgt-makeflags.exp      |   10 +-
 contrib/bmake/unit-tests/deptgt-order.exp          |    3 +
 contrib/bmake/unit-tests/deptgt-order.mk           |   18 +-
 contrib/bmake/unit-tests/deptgt.exp                |    8 +-
 contrib/bmake/unit-tests/deptgt.mk                 |    4 +-
 contrib/bmake/unit-tests/directive-export-impl.exp |   88 +-
 contrib/bmake/unit-tests/directive-export-impl.mk  |   23 +-
 contrib/bmake/unit-tests/directive-export.mk       |   15 +-
 contrib/bmake/unit-tests/directive-for-errors.exp  |    2 +-
 contrib/bmake/unit-tests/directive-for-errors.mk   |    6 +-
 contrib/bmake/unit-tests/directive-for-escape.exp  |   32 +-
 contrib/bmake/unit-tests/directive-for-escape.mk   |   21 +-
 contrib/bmake/unit-tests/directive-for.exp         |    2 +-
 contrib/bmake/unit-tests/directive-undef.exp       |    3 +-
 contrib/bmake/unit-tests/directive-undef.mk        |   21 +-
 .../bmake/unit-tests/directive-unexport-env.exp    |   20 +-
 contrib/bmake/unit-tests/directive.exp             |    8 +-
 contrib/bmake/unit-tests/include-main.exp          |    2 +-
 contrib/bmake/unit-tests/job-output-null.exp       |    4 +
 contrib/bmake/unit-tests/job-output-null.mk        |   32 +
 .../bmake/unit-tests/jobs-empty-commands-error.exp |    5 +
 .../bmake/unit-tests/jobs-empty-commands-error.mk  |   19 +
 contrib/bmake/unit-tests/moderrs.exp               |   97 +-
 contrib/bmake/unit-tests/moderrs.mk                |   25 +-
 contrib/bmake/unit-tests/modts.exp                 |    4 +-
 contrib/bmake/unit-tests/modword.exp               |   24 +-
 contrib/bmake/unit-tests/modword.mk                |    3 +-
 contrib/bmake/unit-tests/opt-chdir.mk              |    6 +-
 contrib/bmake/unit-tests/opt-debug-errors-jobs.exp |   48 +
 contrib/bmake/unit-tests/opt-debug-errors-jobs.mk  |   36 +
 contrib/bmake/unit-tests/opt-debug-lint.exp        |    2 +-
 contrib/bmake/unit-tests/opt-debug-lint.mk         |   20 +-
 contrib/bmake/unit-tests/opt-debug.exp             |    6 +-
 contrib/bmake/unit-tests/opt-file.mk               |    6 +-
 contrib/bmake/unit-tests/opt-jobs-no-action.mk     |    4 +-
 contrib/bmake/unit-tests/recursive.mk              |    7 +-
 contrib/bmake/unit-tests/sh-jobs.mk                |    8 +-
 contrib/bmake/unit-tests/shell-csh.mk              |    4 +-
 contrib/bmake/unit-tests/suff-incomplete.exp       |   10 +-
 contrib/bmake/unit-tests/suff-main-several.exp     |   24 +-
 contrib/bmake/unit-tests/suff-rebuild.exp          |   14 +-
 contrib/bmake/unit-tests/var-class-cmdline.exp     |    3 +
 contrib/bmake/unit-tests/var-class-cmdline.mk      |   80 +-
 contrib/bmake/unit-tests/var-eval-short.exp        |   29 +
 contrib/bmake/unit-tests/var-eval-short.mk         |  163 ++
 contrib/bmake/unit-tests/var-op-append.exp         |   12 +-
 contrib/bmake/unit-tests/var-op-append.mk          |    4 +-
 contrib/bmake/unit-tests/var-op-assign.mk          |    4 +-
 contrib/bmake/unit-tests/var-op-sunsh.mk           |   12 +-
 contrib/bmake/unit-tests/varcmd.mk                 |   14 +-
 contrib/bmake/unit-tests/vardebug.exp              |  119 +-
 contrib/bmake/unit-tests/varmisc.exp               |    2 +-
 contrib/bmake/unit-tests/varmod-assign.exp         |   22 +-
 contrib/bmake/unit-tests/varmod-assign.mk          |   39 +-
 contrib/bmake/unit-tests/varmod-defined.exp        |   34 +-
 contrib/bmake/unit-tests/varmod-defined.mk         |    6 +-
 contrib/bmake/unit-tests/varmod-edge.exp           |   12 +-
 contrib/bmake/unit-tests/varmod-edge.mk            |   26 +-
 contrib/bmake/unit-tests/varmod-hash.exp           |    6 +-
 contrib/bmake/unit-tests/varmod-ifelse.exp         |   22 +-
 contrib/bmake/unit-tests/varmod-ifelse.mk          |   64 +-
 contrib/bmake/unit-tests/varmod-indirect.exp       |   84 +-
 contrib/bmake/unit-tests/varmod-indirect.mk        |  100 +-
 contrib/bmake/unit-tests/varmod-loop-varname.exp   |   11 +
 contrib/bmake/unit-tests/varmod-loop-varname.mk    |  127 +
 contrib/bmake/unit-tests/varmod-loop.exp           |   19 +-
 contrib/bmake/unit-tests/varmod-loop.mk            |  156 +-
 contrib/bmake/unit-tests/varmod-match-escape.exp   |   74 +-
 contrib/bmake/unit-tests/varmod-match-escape.mk    |    8 +-
 contrib/bmake/unit-tests/varmod-order.exp          |    4 +-
 contrib/bmake/unit-tests/varmod-range.exp          |   10 +-
 contrib/bmake/unit-tests/varmod-remember.exp       |    2 -
 contrib/bmake/unit-tests/varmod-remember.mk        |   29 +-
 contrib/bmake/unit-tests/varmod-shell.mk           |    9 +-
 contrib/bmake/unit-tests/varmod-subst-regex.exp    |   25 +-
 contrib/bmake/unit-tests/varmod-subst-regex.mk     |   54 +-
 contrib/bmake/unit-tests/varmod-subst.exp          |    2 +-
 contrib/bmake/unit-tests/varmod-subst.mk           |   10 +-
 contrib/bmake/unit-tests/varmod-sun-shell.exp      |    2 +
 contrib/bmake/unit-tests/varmod-sun-shell.mk       |   21 +
 contrib/bmake/unit-tests/varmod-sysv.exp           |  147 +-
 contrib/bmake/unit-tests/varmod-sysv.mk            |   57 +-
 contrib/bmake/unit-tests/varmod-to-separator.exp   |   12 +-
 contrib/bmake/unit-tests/varmod-unique.mk          |   12 +-
 contrib/bmake/unit-tests/varname-dot-shell.exp     |   32 +-
 contrib/bmake/unit-tests/varname-empty.exp         |   60 +-
 contrib/bmake/unit-tests/varname-empty.mk          |    4 +-
 contrib/bmake/unit-tests/varname.exp               |   33 +-
 contrib/bmake/unit-tests/varparse-dynamic.mk       |    6 +-
 contrib/bmake/unit-tests/varparse-errors.exp       |    4 +-
 contrib/bmake/unit-tests/varparse-errors.mk        |    4 +-
 contrib/bmake/var.c                                | 3073 +++++++++++---------
 144 files changed, 5499 insertions(+), 3548 deletions(-)

diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog
index 5cf6f9d8fe57..35235e1f8205 100644
--- a/contrib/bmake/ChangeLog
+++ b/contrib/bmake/ChangeLog
@@ -1,3 +1,116 @@
+2021-06-21  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210621
+	Merge with NetBSD make, pick up
+	o var.c: only report error for unmatched regex subexpression
+	when linting (-dL) since we cannot tell when an unmatched
+	subexpression is an expected result.
+	o move unmatched regex subexpression tests to
+	varmod-subst-regex.mk and enable strict (lint) mode
+
+2021-06-16  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210616
+	Merge with NetBSD make, pick up
+	o more unit tests
+	o cond.c: rename If_Eval to EvalBare
+	improve function names for parsing conditions
+	o job.c: fix error handling of targets that cannot be made
+	o var.c: uncompress code in ApplyModifier_Unique
+
+2021-05-18  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210518
+	Merge with NetBSD make, pick up
+	o fix unit-tests/opt-chdir to cope with /nonexistent existing.
+	o job.c: Print -de error information when running multiple jobs
+
+2021-04-20  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210420
+	Merge with NetBSD make, pick up
+	o use C99 bool type
+	o convert VarEvalFlags back into an enum
+	o cond.c: do not complain when skipping the condition 'no >= 10'
+	o hash.c: avoid allocating memory for simple variable names
+	o job.c: use distinct wording for writing to the shell commands file
+	remove type name for the abort status in job handling
+	rename PrintOutput to PrintFilteredOutput to avoid confusion
+	o main.c: avoid double slash in name of temporary directory
+	o var.c: use straight quotes for error 'Bad conditional expression'
+	reduce memory allocations in the modifiers ':D' and ':U'
+	rename members of ModifyWord_LoopArgs
+	clean up pattern flags for the modifiers ':S' and ':C'
+	reduce memory allocation and strlen calls in modifier ':from=to'
+	in the ':Q' modifier, only allocate memory if necessary
+	improve performance for LazyBuf
+	remove redundant parameter from ParseVarnameLong
+	migrate ParseModifierPart to use Substring
+	avoid unnecessary calls to strlen when evaluating modifiers
+	migrate ModifyWord functions to use Substring
+	migrate handling of the modifier ':S,from,to,' to Substring
+	reduce debug logging and memory allocation for ${:U...}
+	reduce verbosity of the -dv debug logging for standard cases
+	clean up debug logging for ':M' and ':N'
+	disallow '$' in the variable name of the modifier ':@'
+	simplify access to the name of an expression during evaluation
+
+2021-03-30  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210330
+	Merge with NetBSD make, pick up
+	o replace enum bit-field with struct bit-field for VarEvalFlags
+	o rename VARE_NONE to VARE_PARSE_ONLY
+	o var.c: rename ApplyModifiersState to ModChain
+	fix double varname expansion in the variable modifier '::='
+	change debug log for variable evaluation flags to lowercase
+
+2021-03-14  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210314
+	Merge with NetBSD make, pick up
+	o var.c: avoid evaluating many modifiers in parse only mode
+	in strict mode (-dL) many variable references are parsed twice,
+	the first time just to report parse errors early, so we want to
+	avoid side effects and wasted effort to the extent possible.
+
+2021-02-26  Simon J Gerraty  <sjg@beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210226
+	Merge with NetBSD make, pick up
+	o remove freestanding freeIt variables
+	link via FStr
+	o var.c: restructure code in ParseVarname to target human readers
+	improve error message for;
+	  bad modifier in variable expression
+	  unclosed modifier
+	  unknown modifier
+	remove redundant parameter of ApplySingleModifier
+	explain non-obvious code around indirect variable modifiers
+	quote ':S' in error message about missing delimiter
+	extract ParseModifier_Match into separate function
+	add context information to error message about ':range' modifier
+	add quotes around variable name in an error message
+	reorder code in ModifyWords
+	use more common parameter order for VarSelectWords
+	make ModifyWord_Subst a little easier to understand
+	do not expand variable name from the command line twice
+	extract ExistsInCmdline from Var_SetWithFlags
+	save a hash map lookup when defining a cmdline variable
+	clean up VarAdd, Var_Delete, Var_ReexportVars
+	use bit-shift expressions for VarFlags constants
+	rename constants for VarFlags
+	rename ExprDefined constants for debug logging
+	rename ExprStatus to ExprDefined
+	split parameters for evaluating variable expressions
+	reduce redundant code around ModifyWords
+	print error about failed shell command before overwriting variable
+	clean up ValidShortVarname, ParseVarnameShort
+	rename VarExprStatus to ExprStatus
+	add functions for assigning the value of an expression
+	rename ApplyModifiersState_Define to Expr_Define
+	condense the code for parsing :S and :C modifiers
+
 2021-02-06  Simon J Gerraty  <sjg@beast.crufty.net>
 
 	* VERSION (_MAKE_VERSION): 20210206
diff --git a/contrib/bmake/FILES b/contrib/bmake/FILES
index 5e7b8301da87..dc0f6f33c763 100644
--- a/contrib/bmake/FILES
+++ b/contrib/bmake/FILES
@@ -63,6 +63,7 @@ realpath.c
 setenv.c
 sigcompat.c
 str.c
+str.h
 stresep.c
 strlcpy.c
 suff.c
@@ -399,6 +400,10 @@ unit-tests/job-flags.exp
 unit-tests/job-flags.mk
 unit-tests/job-output-long-lines.exp
 unit-tests/job-output-long-lines.mk
+unit-tests/job-output-null.exp
+unit-tests/job-output-null.mk
+unit-tests/jobs-empty-commands-error.exp
+unit-tests/jobs-empty-commands-error.mk
 unit-tests/jobs-empty-commands.exp
 unit-tests/jobs-empty-commands.mk
 unit-tests/jobs-error-indirect.exp
@@ -439,6 +444,8 @@ unit-tests/opt-debug-curdir.exp
 unit-tests/opt-debug-curdir.mk
 unit-tests/opt-debug-dir.exp
 unit-tests/opt-debug-dir.mk
+unit-tests/opt-debug-errors-jobs.exp
+unit-tests/opt-debug-errors-jobs.mk
 unit-tests/opt-debug-errors.exp
 unit-tests/opt-debug-errors.mk
 unit-tests/opt-debug-file.exp
@@ -627,6 +634,8 @@ unit-tests/var-class-local.exp
 unit-tests/var-class-local.mk
 unit-tests/var-class.exp
 unit-tests/var-class.mk
+unit-tests/var-eval-short.exp
+unit-tests/var-eval-short.mk
 unit-tests/var-op-append.exp
 unit-tests/var-op-append.mk
 unit-tests/var-op-assign.exp
@@ -675,6 +684,8 @@ unit-tests/varmod-l-name-to-value.exp
 unit-tests/varmod-l-name-to-value.mk
 unit-tests/varmod-localtime.exp
 unit-tests/varmod-localtime.mk
+unit-tests/varmod-loop-varname.exp
+unit-tests/varmod-loop-varname.mk
 unit-tests/varmod-loop.exp
 unit-tests/varmod-loop.mk
 unit-tests/varmod-match-escape.exp
@@ -709,6 +720,8 @@ unit-tests/varmod-subst-regex.exp
 unit-tests/varmod-subst-regex.mk
 unit-tests/varmod-subst.exp
 unit-tests/varmod-subst.mk
+unit-tests/varmod-sun-shell.exp
+unit-tests/varmod-sun-shell.mk
 unit-tests/varmod-sysv.exp
 unit-tests/varmod-sysv.mk
 unit-tests/varmod-tail.exp
diff --git a/contrib/bmake/VERSION b/contrib/bmake/VERSION
index 0af794962680..7c28f11013b7 100644
--- a/contrib/bmake/VERSION
+++ b/contrib/bmake/VERSION
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20210206
+_MAKE_VERSION=20210621
diff --git a/contrib/bmake/arch.c b/contrib/bmake/arch.c
index e5c0a5e4ac0f..6d9dd60dfbe9 100644
--- a/contrib/bmake/arch.c
+++ b/contrib/bmake/arch.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.197 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.200 2021/05/30 21:16:54 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -147,7 +147,7 @@ struct ar_hdr {
 #include "dir.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.197 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.200 2021/05/30 21:16:54 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -216,6 +216,19 @@ ArchFree(void *ap)
 }
 #endif
 
+/* Return "archive(member)". */
+static char *
+FullName(const char *archive, const char *member)
+{
+	size_t len1 = strlen(archive);
+	size_t len3 = strlen(member);
+	char *result = bmake_malloc(len1 + 1 + len3 + 1 + 1);
+	memcpy(result, archive, len1);
+	memcpy(result + len1, "(", 1);
+	memcpy(result + len1 + 1, member, len3);
+	memcpy(result + len1 + 1 + len3, ")", 1 + 1);
+	return result;
+}
 
 /*
  * Parse an archive specification such as "archive.a(member1 member2.${EXT})",
@@ -228,10 +241,10 @@ ArchFree(void *ap)
  *	scope		The scope in which to expand variables.
  *
  * Output:
- *	return		TRUE if it was a valid specification.
+ *	return		True if it was a valid specification.
  *	*pp		Points to the first non-space after the archive spec.
  */
-Boolean
+bool
 Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 {
 	char *cp;		/* Pointer into line */
@@ -239,12 +252,12 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 	MFStr libName;		/* Library-part of specification */
 	char *memName;		/* Member-part of specification */
 	char saveChar;		/* Ending delimiter of member-name */
-	Boolean expandLibName;	/* Whether the parsed libName contains
+	bool expandLibName;	/* Whether the parsed libName contains
 				 * variable expressions that need to be
 				 * expanded */
 
 	libName = MFStr_InitRefer(*pp);
-	expandLibName = FALSE;
+	expandLibName = false;
 
 	for (cp = libName.str; *cp != '(' && *cp != '\0';) {
 		if (*cp == '$') {
@@ -252,18 +265,18 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 			/* XXX: This code can probably be shortened. */
 			const char *nested_p = cp;
 			FStr result;
-			Boolean isError;
+			bool isError;
 
 			/* XXX: is expanded twice: once here and once below */
 			(void)Var_Parse(&nested_p, scope,
-					VARE_WANTRES | VARE_UNDEFERR, &result);
+			    VARE_UNDEFERR, &result);
 			/* TODO: handle errors */
 			isError = result.str == var_Error;
 			FStr_Done(&result);
 			if (isError)
-				return FALSE;
+				return false;
 
-			expandLibName = TRUE;
+			expandLibName = true;
 			cp += nested_p - cp;
 		} else
 			cp++;
@@ -272,8 +285,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 	*cp++ = '\0';
 	if (expandLibName) {
 		char *expanded;
-		(void)Var_Subst(libName.str, scope,
-		    VARE_WANTRES | VARE_UNDEFERR, &expanded);
+		(void)Var_Subst(libName.str, scope, VARE_UNDEFERR, &expanded);
 		/* TODO: handle errors */
 		libName = MFStr_InitOwn(expanded);
 	}
@@ -285,7 +297,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 		 * place and skip to the end of it (either white-space or
 		 * a close paren).
 		 */
-		Boolean doSubst = FALSE;
+		bool doSubst = false;
 
 		pp_skip_whitespace(&cp);
 
@@ -295,20 +307,19 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 				/* Expand nested variable expressions. */
 				/* XXX: This code can probably be shortened. */
 				FStr result;
-				Boolean isError;
+				bool isError;
 				const char *nested_p = cp;
 
 				(void)Var_Parse(&nested_p, scope,
-						VARE_WANTRES | VARE_UNDEFERR,
-						&result);
+				    VARE_UNDEFERR, &result);
 				/* TODO: handle errors */
 				isError = result.str == var_Error;
 				FStr_Done(&result);
 
 				if (isError)
-					return FALSE;
+					return false;
 
-				doSubst = TRUE;
+				doSubst = true;
 				cp += nested_p - cp;
 			} else {
 				cp++;
@@ -325,7 +336,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 			Parse_Error(PARSE_FATAL,
 				    "No closing parenthesis "
 				    "in archive specification");
-			return FALSE;
+			return false;
 		}
 
 		/*
@@ -355,16 +366,15 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 			char *p;
 			char *unexpandedMemName = memName;
 
-			(void)Var_Subst(memName, scope,
-					VARE_WANTRES | VARE_UNDEFERR,
-					&memName);
+			(void)Var_Subst(memName, scope, VARE_UNDEFERR,
+			    &memName);
 			/* TODO: handle errors */
 
 			/*
 			 * Now form an archive spec and recurse to deal with
 			 * nested variables and multi-word variable values.
 			 */
-			fullName = str_concat4(libName.str, "(", memName, ")");
+			fullName = FullName(libName.str, memName);
 			p = fullName;
 
 			if (strchr(memName, '$') != NULL &&
@@ -383,7 +393,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 				/* Error in nested call. */
 				free(fullName);
 				/* XXX: does unexpandedMemName leak? */
-				return FALSE;
+				return false;
 			}
 			free(fullName);
 			/* XXX: does unexpandedMemName leak? */
@@ -394,8 +404,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 
 			while (!Lst_IsEmpty(&members)) {
 				char *member = Lst_Dequeue(&members);
-				char *fullname = str_concat4(libName.str, "(",
-							     member, ")");
+				char *fullname = FullName(libName.str, member);
 				free(member);
 
 				gn = Targ_GetNode(fullname);
@@ -407,8 +416,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 			Lst_Done(&members);
 
 		} else {
-			char *fullname = str_concat4(libName.str, "(", memName,
-						     ")");
+			char *fullname = FullName(libName.str, memName);
 			gn = Targ_GetNode(fullname);
 			free(fullname);
 
@@ -434,7 +442,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
 	/* We promised that pp would be set up at the next non-space. */
 	pp_skip_whitespace(&cp);
 	*pp = cp;
-	return TRUE;
+	return true;
 }
 
 /*
@@ -444,7 +452,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
  * Input:
  *	archive		Path to the archive
  *	member		Name of member; only its basename is used.
- *	addToCache	TRUE if archive should be cached if not already so.
+ *	addToCache	True if archive should be cached if not already so.
  *
  * Results:
  *	The ar_hdr for the member, or NULL.
@@ -452,7 +460,7 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope)
  * See ArchFindMember for an almost identical copy of this code.
  */
 static struct ar_hdr *
-ArchStatMember(const char *archive, const char *member, Boolean addToCache)
+ArchStatMember(const char *archive, const char *member, bool addToCache)
 {
 #define AR_MAX_NAME_LEN (sizeof arh.ar_name - 1)
 	FILE *arch;
@@ -713,7 +721,7 @@ ArchSVR4Entry(Arch *ar, char *inout_name, size_t size, FILE *arch)
 #endif
 
 
-static Boolean
+static bool
 ArchiveMember_HasName(const struct ar_hdr *hdr,
 		      const char *name, size_t namelen)
 {
@@ -721,22 +729,22 @@ ArchiveMember_HasName(const struct ar_hdr *hdr,
 	const char *ar_name = hdr->AR_NAME;
 
 	if (strncmp(ar_name, name, namelen) != 0)
-		return FALSE;
+		return false;
 
 	if (namelen >= ar_name_len)
 		return namelen == ar_name_len;
 
 	/* hdr->AR_NAME is space-padded to the right. */
 	if (ar_name[namelen] == ' ')
-		return TRUE;
+		return true;
 
 	/* In archives created by GNU binutils 2.27, the member names end with
 	 * a slash. */
 	if (ar_name[namelen] == '/' &&
 	    (namelen == ar_name_len || ar_name[namelen + 1] == ' '))
-		return TRUE;
+		return true;
 
-	return FALSE;
+	return false;
 }
 
 /*
@@ -951,7 +959,7 @@ Arch_UpdateMTime(GNode *gn)
 {
 	struct ar_hdr *arh;
 
-	arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), TRUE);
+	arh = ArchStatMember(GNode_VarArchive(gn), GNode_VarMember(gn), true);
 	if (arh != NULL)
 		gn->mtime = (time_t)strtol(arh->ar_date, NULL, 10);
 	else
@@ -1058,26 +1066,26 @@ Arch_FindLib(GNode *gn, SearchPath *path)
  *	since this is used by 'ar' rules that affect the data contents of the
  *	archive, not by ranlib rules, which affect the TOC.
  */
-Boolean
+bool
 Arch_LibOODate(GNode *gn)
 {
-	Boolean oodate;
+	bool oodate;
 
 	if (gn->type & OP_PHONY) {
-		oodate = TRUE;
+		oodate = true;
 	} else if (!GNode_IsTarget(gn) && Lst_IsEmpty(&gn->children)) {
-		oodate = FALSE;
+		oodate = false;
 	} else if ((!Lst_IsEmpty(&gn->children) && gn->youngestChild == NULL) ||
 		   (gn->mtime > now) ||
 		   (gn->youngestChild != NULL &&
 		    gn->mtime < gn->youngestChild->mtime)) {
-		oodate = TRUE;
+		oodate = true;
 	} else {
 #ifdef RANLIBMAG
 		struct ar_hdr *arh;	/* Header for __.SYMDEF */
 		int modTimeTOC;		/* The table-of-contents' mod time */
 
-		arh = ArchStatMember(gn->path, RANLIBMAG, FALSE);
+		arh = ArchStatMember(gn->path, RANLIBMAG, false);
 
 		if (arh != NULL) {
 			modTimeTOC = (int)strtol(arh->ar_date, NULL, 10);
@@ -1094,10 +1102,10 @@ Arch_LibOODate(GNode *gn)
 			 */
 			if (DEBUG(ARCH) || DEBUG(MAKE))
 				debug_printf("no toc...");
-			oodate = TRUE;
+			oodate = true;
 		}
 #else
-		oodate = FALSE;
+		oodate = false;
 #endif
 	}
 	return oodate;
@@ -1119,7 +1127,7 @@ Arch_End(void)
 #endif
 }
 
-Boolean
+bool
 Arch_IsLib(GNode *gn)
 {
 	static const char armag[] = "!<arch>\n";
@@ -1127,11 +1135,11 @@ Arch_IsLib(GNode *gn)
 	int fd;
 
 	if ((fd = open(gn->path, O_RDONLY)) == -1)
-		return FALSE;
+		return false;
 
 	if (read(fd, buf, sizeof buf) != sizeof buf) {
 		(void)close(fd);
-		return FALSE;
+		return false;
 	}
 
 	(void)close(fd);
diff --git a/contrib/bmake/buf.h b/contrib/bmake/buf.h
index 594e9651dbfb..938820e4745f 100644
--- a/contrib/bmake/buf.h
+++ b/contrib/bmake/buf.h
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.42 2021/01/30 21:25:10 rillig Exp $	*/
+/*	$NetBSD: buf.h,v 1.43 2021/04/03 11:08:40 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -101,7 +101,7 @@ Buf_AddByte(Buffer *buf, char byte)
 	end[1] = '\0';
 }
 
-MAKE_INLINE Boolean
+MAKE_INLINE bool
 Buf_EndsWith(const Buffer *buf, char ch)
 {
 	return buf->len > 0 && buf->data[buf->len - 1] == ch;
diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c
index 59190d8c4354..f8c47397f3df 100644
--- a/contrib/bmake/compat.c
+++ b/contrib/bmake/compat.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: compat.c,v 1.227 2021/04/27 15:19:25 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.224 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.227 2021/04/27 15:19:25 christos Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -164,7 +164,7 @@ CompatInterrupt(int signo)
 }
 
 static void
-DebugFailedTarget(const char *cmd, GNode *gn)
+DebugFailedTarget(const char *cmd, const GNode *gn)
 {
 	const char *p = cmd;
 	debug_printf("\n*** Failed target:  %s\n*** Failed command: ",
@@ -184,7 +184,7 @@ DebugFailedTarget(const char *cmd, GNode *gn)
 	debug_printf("\n");
 }
 
-static Boolean
+static bool
 UseShell(const char *cmd MAKE_ATTR_UNUSED)
 {
 #if !defined(MAKE_NATIVE)
@@ -194,7 +194,7 @@ UseShell(const char *cmd MAKE_ATTR_UNUSED)
 	 * behaviour.  Or perhaps the shell has been replaced with something
 	 * that does extra logging, and that should not be bypassed.
 	 */
-	return TRUE;
+	return true;
 #else
 	/*
 	 * Search for meta characters in the command. If there are no meta
@@ -227,22 +227,22 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
 {
 	char *cmdStart;		/* Start of expanded command */
 	char *bp;
-	Boolean silent;		/* Don't print command */
-	Boolean doIt;		/* Execute even if -n */
-	volatile Boolean errCheck; /* Check errors */
+	bool silent;		/* Don't print command */
+	bool doIt;		/* Execute even if -n */
+	volatile bool errCheck; /* Check errors */
 	WAIT_T reason;		/* Reason for child's death */
 	WAIT_T status;		/* Description of child's death */
 	pid_t cpid;		/* Child actually found */
 	pid_t retstat;		/* Result of wait */
 	const char **volatile av; /* Argument vector for thing to exec */
 	char **volatile mav;	/* Copy of the argument vector for freeing */
-	Boolean useShell;	/* TRUE if command should be executed
+	bool useShell;		/* True if command should be executed
 				 * using a shell */
 	const char *volatile cmd = cmdp;
 
 	silent = (gn->type & OP_SILENT) != 0;
 	errCheck = !(gn->type & OP_IGNORE);
-	doIt = FALSE;
+	doIt = false;
 
 	(void)Var_Subst(cmd, gn, VARE_WANTRES, &cmdStart);
 	/* TODO: handle errors */
@@ -281,9 +281,9 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
 		if (*cmd == '@')
 			silent = !DEBUG(LOUD);
 		else if (*cmd == '-')
-			errCheck = FALSE;
+			errCheck = false;
 		else if (*cmd == '+') {
-			doIt = TRUE;
+			doIt = true;
 			if (shellName == NULL)	/* we came here from jobs */
 				Shell_Init();
 		} else
@@ -343,7 +343,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
 		 * command into words to form an argument vector we can
 		 * execute.
 		 */
-		Words words = Str_Words(cmd, FALSE);
+		Words words = Str_Words(cmd, false);
 		mav = words.words;
 		bp = words.freeIt;
 		av = (void *)mav;
@@ -392,7 +392,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
 	 */
 	while ((retstat = wait(&reason)) != cpid) {
 		if (retstat > 0)
-			JobReapChild(retstat, reason, FALSE); /* not ours? */
+			JobReapChild(retstat, reason, false); /* not ours? */
 		if (retstat == -1 && errno != EINTR) {
 			break;
 		}
@@ -425,7 +425,7 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln)
 		if (errCheck) {
 #ifdef USE_META
 			if (useMeta) {
-				meta_job_error(NULL, gn, FALSE, status);
+				meta_job_error(NULL, gn, false, status);
 			}
 #endif
 			gn->made = ERROR;
@@ -483,7 +483,7 @@ MakeNodes(GNodeList *gnodes, GNode *pgn)
 	}
 }
 
-static Boolean
+static bool
 MakeUnmade(GNode *gn, GNode *pgn)
 {
 
@@ -493,7 +493,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 	 * First mark ourselves to be made, then apply whatever transformations
 	 * the suffix module thinks are necessary. Once that's done, we can
 	 * descend and make all our children. If any of them has an error
-	 * but the -k flag was given, our 'make' field will be set to FALSE
+	 * but the -k flag was given, our 'make' field will be set to false
 	 * again. This is our signal to not attempt to do anything but abort
 	 * our parent as well.
 	 */
@@ -508,7 +508,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 	if (!(gn->flags & REMAKE)) {
 		gn->made = ABORTED;
 		pgn->flags &= ~(unsigned)REMAKE;
-		return FALSE;
+		return false;
 	}
 
 	if (Lst_FindDatum(&gn->implicitParents, pgn) != NULL)
@@ -524,7 +524,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 	if (!GNode_IsOODate(gn)) {
 		gn->made = UPTODATE;
 		DEBUG0(MAKE, "up-to-date.\n");
-		return FALSE;
+		return false;
 	}
 
 	/*
@@ -539,7 +539,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 	 * We need to be re-made.
 	 * Ensure that $? (.OODATE) and $> (.ALLSRC) are both set.
 	 */
-	Make_DoAllVar(gn);
+	GNode_SetLocalVars(gn);
 
 	/*
 	 * Alter our type to tell if errors should be ignored or things
@@ -596,7 +596,7 @@ MakeUnmade(GNode *gn, GNode *pgn)
 		PrintOnError(gn, "\nStop.");
 		exit(1);
 	}
-	return TRUE;
+	return true;
 }
 
 static void
diff --git a/contrib/bmake/cond.c b/contrib/bmake/cond.c
index 8f36fda22f12..a8d88d1d6816 100644
--- a/contrib/bmake/cond.c
+++ b/contrib/bmake/cond.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.256 2021/02/05 05:15:12 rillig Exp $	*/
+/*	$NetBSD: cond.c,v 1.267 2021/06/11 14:52:03 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.256 2021/02/05 05:15:12 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.267 2021/06/11 14:52:03 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -148,11 +148,11 @@ typedef struct CondParser {
 	 * expression has length > 0.  The other '.if' variants delegate
 	 * to evalBare instead.
 	 */
-	Boolean plain;
+	bool plain;
 
 	/* The function to apply on unquoted bare words. */
-	Boolean (*evalBare)(size_t, const char *);
-	Boolean negateEvalBare;
+	bool (*evalBare)(size_t, const char *);
+	bool negateEvalBare;
 
 	const char *p;		/* The remaining condition to parse */
 	Token curr;		/* Single push-back token used in parsing */
@@ -163,10 +163,10 @@ typedef struct CondParser {
 	 * specific one, therefore it makes sense to suppress the standard
 	 * "Malformed conditional" message.
 	 */
-	Boolean printedError;
+	bool printedError;
 } CondParser;
 
-static CondResult CondParser_Or(CondParser *par, Boolean);
+static CondResult CondParser_Or(CondParser *par, bool);
 
 static unsigned int cond_depth = 0;	/* current .if nesting level */
 static unsigned int cond_min_depth = 0;	/* depth at makefile open */
@@ -178,21 +178,21 @@ static const char *opname[] = { "<", "<=", ">", ">=", "==", "!=" };
  * In strict mode, the lhs must be a variable expression or a string literal
  * in quotes. In non-strict mode it may also be an unquoted string literal.
  *
- * TRUE when CondEvalExpression is called from Cond_EvalLine (.if etc)
- * FALSE when CondEvalExpression is called from ApplyModifier_IfElse
+ * True when CondEvalExpression is called from Cond_EvalLine (.if etc).
+ * False when CondEvalExpression is called from ApplyModifier_IfElse
  * since lhs is already expanded, and at that point we cannot tell if
  * it was a variable reference or not.
  */
-static Boolean lhsStrict;
+static bool lhsStrict;
 
-static Boolean
+static bool
 is_token(const char *str, const char *tok, size_t len)
 {
 	return strncmp(str, tok, len) == 0 && !ch_isalpha(str[len]);
 }
 
 static Token
-ToToken(Boolean cond)
+ToToken(bool cond)
 {
 	return cond ? TOK_TRUE : TOK_FALSE;
 }
@@ -228,7 +228,7 @@ CondParser_SkipWhitespace(CondParser *par)
  * Return the length of the argument, or 0 on error.
  */
 static size_t
-ParseFuncArg(CondParser *par, const char **pp, Boolean doEval, const char *func,
+ParseFuncArg(CondParser *par, const char **pp, bool doEval, const char *func,
 	     char **out_arg)
 {
 	const char *p = *pp;
@@ -264,11 +264,11 @@ ParseFuncArg(CondParser *par, const char **pp, Boolean doEval, const char *func,
 			 * so we don't need to do it. Nor do we return an
 			 * error, though perhaps we should.
 			 */
-			VarEvalFlags eflags = doEval
-			    ? VARE_WANTRES | VARE_UNDEFERR
-			    : VARE_NONE;
+			VarEvalMode emode = doEval
+			    ? VARE_UNDEFERR
+			    : VARE_PARSE_ONLY;
 			FStr nestedVal;
-			(void)Var_Parse(&p, SCOPE_CMDLINE, eflags, &nestedVal);
+			(void)Var_Parse(&p, SCOPE_CMDLINE, emode, &nestedVal);
 			/* TODO: handle errors */
 			Buf_AddStr(&argBuf, nestedVal.str);
 			FStr_Done(&nestedVal);
@@ -290,7 +290,7 @@ ParseFuncArg(CondParser *par, const char **pp, Boolean doEval, const char *func,
 	if (func != NULL && *p++ != ')') {
 		Parse_Error(PARSE_FATAL,
 		    "Missing closing parenthesis for %s()", func);
-		par->printedError = TRUE;
+		par->printedError = true;
 		return 0;
 	}
 
@@ -300,34 +300,34 @@ ParseFuncArg(CondParser *par, const char **pp, Boolean doEval, const char *func,
 
 /* Test whether the given variable is defined. */
 /*ARGSUSED*/
-static Boolean
+static bool
 FuncDefined(size_t argLen MAKE_ATTR_UNUSED, const char *arg)
 {
 	FStr value = Var_Value(SCOPE_CMDLINE, arg);
-	Boolean result = value.str != NULL;
+	bool result = value.str != NULL;
 	FStr_Done(&value);
*** 17372 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202160538.21G5cpXe059594>