git: 8e11a9b4250b - vendor/NetBSD/bmake - Import bmake-20210110

Simon J. Gerraty sjg at FreeBSD.org
Thu Jan 14 01:26:01 UTC 2021


The branch vendor/NetBSD/bmake has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e11a9b4250be3c3379c45fa820bff78d99d5946

commit 8e11a9b4250be3c3379c45fa820bff78d99d5946
Author:     Simon J. Gerraty <sjg at FreeBSD.org>
AuthorDate: 2021-01-14 01:24:34 +0000
Commit:     Simon J. Gerraty <sjg at FreeBSD.org>
CommitDate: 2021-01-14 01:24:34 +0000

    Import bmake-20210110
    
    Quite a lot of churn on style, but lots of
    good work refactoring complicated functions
    and lots more unit-tests.
    Thanks mostly to rillig at NetBSD
    
    Some interesting entries from ChangeLog
    
    o .MAKE.{UID,GID} represent uid and gid running make.
    
    o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
      checks in InitObjdir.  Explicit .OBJDIR target always allows
      read-only directory.
    
    o add more unit tests for META MODE
    
    Change-Id: I4d3bcf08b4c864d98b343f602efe5a75dbfa7a94
---
 ChangeLog                                          |  241 +-
 FILES                                              |   64 +-
 LICENSE                                            |    4 +-
 PSD.doc/tutorial.ms                                |   10 +-
 VERSION                                            |    2 +-
 arch.c                                             | 1323 ++---
 bmake.1                                            |   18 +-
 bmake.cat1                                         |  248 +-
 buf.c                                              |  139 +-
 buf.h                                              |   28 +-
 compat.c                                           |  932 +--
 cond.c                                             | 1611 +++---
 dir.c                                              | 2047 ++++---
 dir.h                                              |   36 +-
 enum.c                                             |   11 +-
 enum.h                                             |   69 +-
 filemon/filemon.h                                  |    6 +-
 filemon/filemon_dev.c                              |    6 +-
 filemon/filemon_ktrace.c                           |   79 +-
 for.c                                              |  633 +-
 hash.c                                             |   41 +-
 hash.h                                             |   72 +-
 import.sh                                          |   87 +
 job.c                                              | 3876 +++++++------
 job.h                                              |   84 +-
 lst.c                                              |  304 +-
 lst.h                                              |   88 +-
 main.c                                             |  364 +-
 make-conf.h                                        |   20 +-
 make.1                                             |   18 +-
 make.c                                             | 1825 +++---
 make.h                                             |  812 +--
 make_malloc.c                                      |    7 +-
 make_malloc.h                                      |   12 +-
 meta.c                                             |  359 +-
 meta.h                                             |    4 +-
 metachar.h                                         |    4 +-
 mk/ChangeLog                                       |   39 +
 mk/dirdeps-options.mk                              |    5 +-
 mk/dirdeps-targets.mk                              |    7 +-
 mk/dirdeps.mk                                      |   25 +-
 mk/init.mk                                         |   17 +-
 mk/install-mk                                      |    4 +-
 mk/meta.subdir.mk                                  |    4 +-
 mk/mkopt.sh                                        |    0
 mk/own.mk                                          |    6 +-
 mk/sys.mk                                          |    6 +-
 nonints.h                                          |  278 +-
 os.sh                                              |    0
 parse.c                                            | 4058 ++++++-------
 pathnames.h                                        |   15 +-
 str.c                                              |   15 +-
 suff.c                                             | 2897 +++++-----
 targ.c                                             |  568 +-
 trace.c                                            |   16 +-
 trace.h                                            |    6 +-
 unit-tests/Makefile                                |  159 +-
 unit-tests/cmd-errors-jobs.exp                     |    9 +
 unit-tests/cmd-errors-jobs.mk                      |   32 +
 unit-tests/cmd-errors.mk                           |    4 +-
 unit-tests/cmdline.mk                              |    2 +-
 unit-tests/compat-error.exp                        |   15 +
 unit-tests/compat-error.mk                         |   37 +
 unit-tests/cond-eof.exp                            |    9 +
 unit-tests/cond-eof.mk                             |   20 +
 unit-tests/cond-func-empty.mk                      |   27 +-
 unit-tests/cond-func-exists.mk                     |   11 +-
 unit-tests/cond-func-make-main.exp                 |    3 +
 unit-tests/cond-func-make-main.mk                  |   62 +
 unit-tests/cond-short.exp                          |   12 +-
 unit-tests/cond-short.mk                           |   64 +-
 unit-tests/cond-token-string.exp                   |    2 +-
 unit-tests/dep-percent.exp                         |    5 +-
 unit-tests/depsrc-meta.exp                         |    4 +
 unit-tests/depsrc-meta.mk                          |   27 +-
 unit-tests/depsrc-optional.exp                     |   18 +-
 unit-tests/depsrc.exp                              |    3 +
 unit-tests/depsrc.mk                               |   17 +-
 unit-tests/deptgt-begin-fail-indirect.exp          |    6 +
 unit-tests/deptgt-begin-fail-indirect.mk           |   16 +
 unit-tests/deptgt-begin-fail.exp                   |    6 +
 unit-tests/deptgt-begin-fail.mk                    |   10 +
 unit-tests/deptgt-end-fail-all.exp                 |    7 +
 unit-tests/deptgt-end-fail-all.mk                  |   19 +
 unit-tests/deptgt-end-fail-indirect.exp            |    7 +
 unit-tests/deptgt-end-fail-indirect.mk             |   16 +
 unit-tests/deptgt-end-fail.exp                     |  163 +
 unit-tests/deptgt-end-fail.mk                      |   69 +
 unit-tests/deptgt-suffixes.exp                     |   26 +
 unit-tests/deptgt-suffixes.mk                      |   23 +-
 unit-tests/deptgt.exp                              |    1 +
 unit-tests/deptgt.mk                               |   10 +-
 unit-tests/directive-elif.exp                      |   32 +-
 unit-tests/directive-elif.mk                       |  126 +-
 unit-tests/directive-else.exp                      |   16 +-
 unit-tests/directive-else.mk                       |   15 +-
 unit-tests/directive-endfor.exp                    |    4 +
 unit-tests/directive-endfor.mk                     |    9 +
 unit-tests/directive-endif.exp                     |    9 +-
 unit-tests/directive-endif.mk                      |   28 +-
 unit-tests/directive-error.mk                      |    6 +-
 unit-tests/directive-export-env.mk                 |    4 +-
 unit-tests/directive-export-impl.exp               |   56 +
 unit-tests/directive-export-impl.mk                |   62 +
 unit-tests/directive-export-literal.mk             |    4 +-
 unit-tests/directive-export.exp                    |    5 +-
 unit-tests/directive-export.mk                     |   16 +-
 unit-tests/directive-for-errors.exp                |   22 +
 unit-tests/directive-for-errors.mk                 |   75 +
 unit-tests/directive-for-escape.exp                |   74 +
 unit-tests/directive-for-escape.mk                 |   96 +
 unit-tests/directive-for-lines.exp                 |   10 +
 unit-tests/directive-for-lines.mk                  |   32 +
 unit-tests/directive-for-null.exp                  |   10 +
 unit-tests/directive-for-null.mk                   |   19 +
 unit-tests/directive-for.exp                       |    7 +-
 unit-tests/directive-for.mk                        |    9 +-
 unit-tests/directive-if.exp                        |    6 +-
 unit-tests/directive-if.mk                         |   14 +-
 unit-tests/directive-include.mk                    |    5 +-
 unit-tests/directive-info.exp                      |   23 +-
 unit-tests/directive-info.mk                       |   18 +-
 unit-tests/directive-misspellings.exp              |   45 +
 unit-tests/directive-misspellings.mk               |   79 +
 unit-tests/directive-undef.exp                     |    3 +-
 unit-tests/directive-undef.mk                      |   85 +-
 unit-tests/directive-unexport-env.exp              |   19 +-
 unit-tests/directive-unexport-env.mk               |   19 +-
 unit-tests/directive-unexport.exp                  |   13 +-
 unit-tests/directive-unexport.mk                   |   12 +-
 unit-tests/directive-warning.exp                   |   16 +-
 unit-tests/directive-warning.mk                    |   10 +-
 unit-tests/jobs-error-indirect.exp                 |    8 +
 unit-tests/jobs-error-indirect.mk                  |   21 +
 unit-tests/jobs-error-nested-make.exp              |   11 +
 unit-tests/jobs-error-nested-make.mk               |   20 +
 unit-tests/jobs-error-nested.exp                   |   15 +
 unit-tests/jobs-error-nested.mk                    |   20 +
 unit-tests/make-exported.mk                        |    2 +-
 unit-tests/meta-cmd-cmp.exp                        |   37 +
 unit-tests/meta-cmd-cmp.mk                         |   52 +
 unit-tests/modmisc.exp                             |    1 -
 unit-tests/modmisc.mk                              |   29 +-
 unit-tests/opt-chdir.exp                           |    4 +-
 unit-tests/opt-debug-errors.exp                    |    5 +-
 unit-tests/opt-debug-graph1.exp                    |   36 +
 unit-tests/opt-debug-jobs.exp                      |    4 +-
 unit-tests/opt-debug-lint.exp                      |    3 +-
 unit-tests/opt-debug-lint.mk                       |   15 +-
 unit-tests/opt-file.exp                            |   13 +-
 unit-tests/opt-file.mk                             |  101 +-
 unit-tests/opt-jobs-no-action.exp                  |   61 +
 unit-tests/opt-jobs-no-action.mk                   |  102 +
 unit-tests/opt-keep-going-multiple.exp             |    9 +
 unit-tests/opt-keep-going-multiple.mk              |   21 +
 unit-tests/opt-keep-going.exp                      |    5 +-
 unit-tests/opt-keep-going.mk                       |    6 +-
 unit-tests/opt-no-action-runflags.exp              |   34 +
 unit-tests/opt-no-action-runflags.mk               |   32 +
 unit-tests/opt.exp                                 |    4 +
 unit-tests/posix.exp                               |    5 +-
 unit-tests/qequals.exp                             |    2 -
 unit-tests/qequals.mk                              |    8 -
 unit-tests/sh-dots.exp                             |   12 +-
 unit-tests/sh-errctl.exp                           |   27 +
 unit-tests/sh-errctl.mk                            |   26 +
 unit-tests/sh-flags.exp                            | 4325 ++++++++++++++
 unit-tests/sh-flags.mk                             |  138 +
 unit-tests/sh-jobs.exp                             |    7 +-
 unit-tests/sh-jobs.mk                              |   34 +-
 unit-tests/sh-meta-chars.mk                        |   17 +-
 unit-tests/shell-csh.mk                            |    6 +-
 unit-tests/suff-add-later.exp                      |    8 +-
 unit-tests/suff-clear-regular.exp                  |    5 +-
 unit-tests/suff-clear-regular.mk                   |    3 +-
 unit-tests/suff-clear-single.exp                   |    5 +-
 unit-tests/suff-incomplete.exp                     |   42 +
 unit-tests/suff-incomplete.mk                      |   31 +
 unit-tests/suff-lookup.exp                         |   21 +-
 unit-tests/suff-main-several.exp                   |  141 +
 unit-tests/suff-main-several.mk                    |   42 +
 unit-tests/suff-phony.exp                          |   13 +
 unit-tests/suff-phony.mk                           |   21 +
 unit-tests/suff-rebuild.exp                        |   76 +-
 unit-tests/suff-rebuild.mk                         |   23 +-
 unit-tests/suff-self.exp                           |    5 +-
 unit-tests/suff-transform-debug.exp                |   62 +
 unit-tests/suff-transform-debug.mk                 |   12 +
 unit-tests/suff-transform-endless.exp              |   44 +-
 unit-tests/suff-transform-endless.mk               |    9 +-
 unit-tests/suff-transform-expand.exp               |    5 +-
 unit-tests/suff-transform-select.exp               |   45 +-
 unit-tests/suff-transform-select.mk                |    7 +-
 unit-tests/use-inference.exp                       |    5 +-
 unit-tests/use-inference.mk                        |    6 +-
 unit-tests/var-op-default.mk                       |   72 +-
 unit-tests/var-op-expand.exp                       |    9 -
 unit-tests/var-op-expand.mk                        |  191 +-
 unit-tests/vardebug.exp                            |    2 +-
 unit-tests/varmisc.mk                              |   14 +-
 unit-tests/varmod-defined.exp                      |   18 +-
 unit-tests/varmod-edge.exp                         |   41 +-
 unit-tests/varmod-extension.exp                    |    1 +
 unit-tests/varmod-extension.mk                     |    4 +-
 unit-tests/varmod-gmtime.exp                       |   40 +-
 unit-tests/varmod-gmtime.mk                        |  197 +-
 unit-tests/varmod-head.exp                         |    1 +
 unit-tests/varmod-head.mk                          |    4 +-
 unit-tests/varmod-ifelse.exp                       |    4 +
 unit-tests/varmod-ifelse.mk                        |   20 +-
 unit-tests/varmod-indirect.exp                     |   59 +
 unit-tests/varmod-indirect.mk                      |  157 +
 unit-tests/varmod-localtime.exp                    |   40 +-
 unit-tests/varmod-localtime.mk                     |  196 +-
 unit-tests/varmod-range.exp                        |    9 +-
 unit-tests/varmod-root.exp                         |    1 +
 unit-tests/varmod-root.mk                          |    4 +-
 unit-tests/varmod-subst-regex.exp                  |    2 +
 unit-tests/varmod-subst-regex.mk                   |    7 +-
 unit-tests/varmod-sysv.exp                         |    4 +-
 unit-tests/varmod-sysv.mk                          |   16 +-
 unit-tests/varmod-tail.exp                         |    1 +
 unit-tests/varmod-tail.mk                          |    4 +-
 unit-tests/varmod-to-many-words.mk                 |   16 +-
 unit-tests/varmod-to-one-word.mk                   |   16 +-
 unit-tests/varmod-to-separator.exp                 |    2 -
 unit-tests/varmod.exp                              |    2 +-
 unit-tests/varmod.mk                               |    4 +-
 unit-tests/varname-dot-makeflags.exp               |    3 +
 unit-tests/varname-dot-makeflags.mk                |   15 +
 unit-tests/varname-dot-shell.exp                   |    2 +-
 .../varname-make_print_var_on_error-jobs.exp       |    5 +-
 unit-tests/varname-make_print_var_on_error-jobs.mk |   15 +-
 unit-tests/varname-make_print_var_on_error.exp     |    3 +-
 unit-tests/varname-make_print_var_on_error.mk      |   15 +-
 unit-tests/varname-makeflags.mk                    |   24 +-
 unit-tests/varparse-dynamic.mk                     |   12 +-
 unit-tests/varparse-errors.exp                     |    6 +-
 unit-tests/varparse-errors.mk                      |   18 +-
 util.c                                             |   91 +-
 var.c                                              | 6056 ++++++++++----------
 241 files changed, 24279 insertions(+), 14537 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ac723511d75a..5cf7f1f45384 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,247 @@
+2021-01-10  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210110
+	Merge with NetBSD make, pick up
+	o fix lint warnings
+	o consistently use boolean expressions in conditions
+
+2021-01-08  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210108
+	Merge with NetBSD make, pick up
+	o job.c: back to polling token pipe if we want a token
+	o main.c: always print 'stopped in' on first call
+	The execption is if we bail because of an abort token
+	in which case just exit 6.
+
+2021-01-01  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20210101
+	Merge with NetBSD make, pick up
+	o Happy New Year!
+	o rename CmdOpts.lint to strict
+	o exit 2 on technical errors
+	o replace pointers in controlling conditions with booleans
+	o replace global preserveUndefined with VARE_KEEP_UNDEF
+	o compat.c: re-export variables from the actual make process
+	if using vfork this is the effect anyway
+	o cond.c: clean up VarParseResult constants
+	o for.c: fix undefined behavior in SubstVarLong
+	make control flow in SubstVarLong of .for loops more obvious
+	clean up SubstVarShort in .for loops
+	extract ForSubstBody from ForReadMore
+	clean up ForReadMore
+	simplify termination condition for .for loop
+	add error handling for .for loop items
+	job.c: re-export variables from the actual make process
+	parse.c: remove mmap for loading files, only allow files < 1 GiB
+	fix edge case in := with undefined in variable name
+	skip variable expansion in ParseDependencyTargetWord
+	var.c: split ExportVar into separate functions
+	clean up code in extracted ExportVar functions
+	remove dead code from ApplyModifiersIndirect
+	split Var_Subst into easily understandable functions
+	clean up VarParseResult constants
+
+2020-12-25  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* main.c: use .MAKE.DEPENDFILE as set by makefiles
+
+2020-12-22  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201222
+	Merge with NetBSD make, pick up
+	o make DEBUG macro return boolean
+	o parse.c: fix assertion failure for files without trailing newline
+	o var.c: allow .undef to undefine multiple variables at once
+	remove excess newline from parse errors
+
+2020-12-21  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201221
+	Merge with NetBSD make, pick up
+	o some unit-test updates
+
+2020-12-20  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201220
+	Merge with NetBSD make, pick up
+	o more unit tests
+	o return FStr from Var_Parse and Var_Value
+	o spell nonexistent consistently
+	o add str_basename to reduce duplicate code
+	o compat.c: fix .ERROR_TARGET in compat -k mode
+	extract InitSignals from Compat_Run
+	extract UseShell from Compat_RunCommand
+	o cond.c: error out if an '.endif' or '.else' contain extraneous text
+	o for.c: rename ForIterate to ForReadMore
+	o hash.c: clean up hash function for HashTable
+	o lst.c: rename Vector.priv_cap to cap
+	o main.c: remove constant parameter from MakeMode
+	o make.c: use symbolic time for 0 in Make_Recheck
+	extract MakeChildren from MakeStartJobs
+	o parse.c: clean up memory handling in VarAssign_EvalShell, Parse_DoVar
+	fix error message for .info/.warning/.error without argument
+	extract Var_Undef from ParseDirective
+	extract ParseSkippedBranches, ParseForLoop from ParseReadLine
+	rename mode constants for ParseGetLine to be more expressive
+	reduce debugging details in Parse_SetInput
+	fix line numbers in .for loops
+	split ParseGetLine into separate functions
+	fix garbled output for failed shell command
+	var.c: remove redundant assignment in ApplyModifier_SysV
+	error out on unknown variable modifiers at parse time
+	remove wrong error message for indirect modifier in lint mode
+	extract ApplySingleModifier from ApplyModifiers
+	use FStr for memory management in Var_SetWithFlags
+	extract SetVar from Var_SetWithFlags
+	use FStr in VarNew
+	extract string functions from ApplyModifier_To
+	error out if .undef has not exactly 1 argument
+	extract Var_DeleteVar from Var_Delete
+	extract Var_Undef from ParseDirective
+	clean up memory management for expanding variable expressions
+
+2020-12-12  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* avoid %zu
+
+	* lst.c: avoid anonymous union
+
+	* VERSION (_MAKE_VERSION): 20201212
+	Merge with NetBSD make, pick up
+	o more unit tests
+	o inline Targ_Ignore and Targ_Silent
+	o split JobFlags into separate fields
+	o remove const from function parameters (left overs from refactoring)
+	o eliminate boolean argument of Var_Export
+	o make API of Buf_Init simpler
+	o rename ParseRunOptions to ParseCommandFlags
+	o replace *line with line[0]
+	o compat.c: fix wrong exit status for multiple failed main targets
+	refactor Compat_Run to show the error condition more clearly
+	don't make .END if the main targets already failed (-k mode)
+	fix exit status in -k mode if a dependency fails
+	o for.c: clean up Buf_AddEscaped in .for loops
+	o job.c: extract ShellWriter_ErrOn from JobPrintCommand
+	make Job_Touch simpler
+	refactor JobFinish
+	rename Shell.exitFlag to errFlag
+	move Job.xtraced to ShellWriter
+	make printing of shell commands independent from the job
+	rename shell flags in struct Shell
+	extract JobOpenTmpFile from JobStart
+	rename RunFlags to CommandFlags
+	split various Job.* into separate fields
+	rename commandShell to shell
+	extract InitShellNameAndPath from Shell_Init
+	replace signal handling macros with local functions
+	replace macro MESSAGE with local function
+	parse.c: error out on null bytes in makefiles
+	error out on misspelled directives
+	rename IFile.nextbuf to readMore
+	fix undefined behavior in ParseEOF
+	str.c: remove redundant call to strlen in Str_Words
+	var.c: error out on misspelled .unexport-env
+	error out on misspelled .export directives
+	extract ExportVars from Var_Export
+	extract ExportVarsExpand from Var_Export
+	eliminate boolean argument of Var_Export
+	fix undefined behavior when exporting ${:U }
+	rename Var_ExportVars to Var_ReexportVars
+	rename Var_Export1 to ExportVar
+
+2020-12-06  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201206
+	Merge with NetBSD make, pick up
+	o more unit tests
+	o inline macros for debug logging
+	o use consistent variable names for list nodes
+	o define constants for enum zero-values
+	o dir.c: use fixed format for debug output of the directory cache
+	remove Dir_InitDir
+	o lst.c: inline Lst_Enqueue, Vector_Done
+	o meta.c: remove unused parameter from meta_needed
+	o parse.c: rename parse functions
+	o suff.c: extract ExpandChildrenRegular from ExpandChildren
+	o targ.c: don't concatenate identifiers in Targ_PrintType
+	o var.c: remove comment decoration
+	extract UnexportVars from Var_UnExport
+	extract GetVarnamesToUnexport from Var_UnExport
+	extract UnexportEnv from Var_UnExport
+	extract UnexportVar from Var_UnExport
+	move CleanEnv to UnexportVars
+	replace pointer comparisons with enum
+	add FStr to var.c to make memory handling simpler
+	use FStr in Var_UnExport
+	move type definitions in var.c to the top
+	extract FreeEnvVar from Var_Parse
+	extract ShuffleStrings from ApplyModifier_Order
+
+2020-11-30  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201130
+	Merge with NetBSD make, pick up
+	o add unit tests for META MODE
+	o reduce memory allocation for dirSearchPath, GNode.parents,
+	GNode.children, OpenDirs
+	o reduce pointer indirection for GNode.cohorts and
+	GNode.implicitParents
+	o remove pointer indirection from GNode.commands
+	o inline Lst_ForEachUntil in meta mode
+	o dir.c: fix memory leak for lstat cache in -DCLEANUP mode
+	clean up memory management for CachedDirs
+	fix the reference count of dotLast going negative
+	add debug logging for OpenDirs_Done
+	extract CacheNewDir from Dir_AddDir
+	add debug logging for reference counting of CachedDir
+	rename some Dir functions to SearchPath
+	o job.c: rename some global variables
+	o main.c: reduce memory allocation in ReadBuiltinRules
+	reduce memory allocation in CmdOpts.create, CmdOpts.variables,
+	CmdOpts.makefiles
+	Add .MAKE.UID and .MAKE.GID
+	o make.c: reduce memory allocation for/in toBeMade,
+	Make_ProcessWait, Make_ExpandUse
+	o meta.c: reduce memory allocation in meta_oodate
+	o parse.c: reduce memory allocations for parsing dependencies and
+	targets
+	o suff.c: reduce memory allocation in suffix handling
+
+2020-11-24  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201124
+	Merge with NetBSD make, pick up
+	o .MAKE.{UID,GID} represent uid and gid running make.
+	o fix error handling for .BEGIN and .END dependency in -k mode
+	o fix missing "Stop." after failed .END node in -k mode
+	o use properly typed comparisons in boolean contexts
+	o replace a few HashTable_CreateEntry with HashTable_Set
+	o add HashSet type
+	o compat.c: split Compat_Make into smaller functions
+	extract DebugFailedTarget from Compat_RunCommand
+	o dir.c: refactor Dir_UpdateMTime
+	migrate CachedDir.files from HashTable to HashSet
+	o make.c: add high-level API for GNode.made
+
+2020-11-22  Simon J Gerraty  <sjg at beast.crufty.net>
+
+	* VERSION (_MAKE_VERSION): 20201122
+	Merge with NetBSD make, pick up
+	o rename GNode.context to vars
+	o suff.c: cleanup and refactor
+	rename some functions and vars to better reflect usage
+	add high-level API for CandidateSearcher
+	o targ.c: add more debug logging for suffix handling
+	o more unit tests
+	o add debug logging for setting and resetting the main target
+
 2020-11-17  Simon J Gerraty  <sjg at beast.crufty.net>
 
 	* VERSION (_MAKE_VERSION): 20201117
 	Merge with NetBSD make, pick up
-	o fix some unit-tests when dash is .SHELL
+	o fix some unit-tests when .SHELL is dash
 	o rename Targ_NewGN to GNode_New
 	o make some GNode functions const
 	o main.c: call Targ_Init before Var_Init
diff --git a/FILES b/FILES
index dedc29767658..8e2513e1c183 100644
--- a/FILES
+++ b/FILES
@@ -75,6 +75,8 @@ unit-tests/archive-suffix.exp
 unit-tests/archive-suffix.mk
 unit-tests/archive.exp
 unit-tests/archive.mk
+unit-tests/cmd-errors-jobs.exp
+unit-tests/cmd-errors-jobs.mk
 unit-tests/cmd-errors-lint.exp
 unit-tests/cmd-errors-lint.mk
 unit-tests/cmd-errors.exp
@@ -87,6 +89,8 @@ unit-tests/cmdline.exp
 unit-tests/cmdline.mk
 unit-tests/comment.exp
 unit-tests/comment.mk
+unit-tests/compat-error.exp
+unit-tests/compat-error.mk
 unit-tests/cond-cmp-numeric-eq.exp
 unit-tests/cond-cmp-numeric-eq.mk
 unit-tests/cond-cmp-numeric-ge.exp
@@ -105,6 +109,8 @@ unit-tests/cond-cmp-string.exp
 unit-tests/cond-cmp-string.mk
 unit-tests/cond-cmp-unary.exp
 unit-tests/cond-cmp-unary.mk
+unit-tests/cond-eof.exp
+unit-tests/cond-eof.mk
 unit-tests/cond-func-commands.exp
 unit-tests/cond-func-commands.mk
 unit-tests/cond-func-defined.exp
@@ -113,6 +119,8 @@ unit-tests/cond-func-empty.exp
 unit-tests/cond-func-empty.mk
 unit-tests/cond-func-exists.exp
 unit-tests/cond-func-exists.mk
+unit-tests/cond-func-make-main.exp
+unit-tests/cond-func-make-main.mk
 unit-tests/cond-func-make.exp
 unit-tests/cond-func-make.mk
 unit-tests/cond-func-target.exp
@@ -213,12 +221,22 @@ unit-tests/depsrc-wait.exp
 unit-tests/depsrc-wait.mk
 unit-tests/depsrc.exp
 unit-tests/depsrc.mk
+unit-tests/deptgt-begin-fail-indirect.exp
+unit-tests/deptgt-begin-fail-indirect.mk
+unit-tests/deptgt-begin-fail.exp
+unit-tests/deptgt-begin-fail.mk
 unit-tests/deptgt-begin.exp
 unit-tests/deptgt-begin.mk
 unit-tests/deptgt-default.exp
 unit-tests/deptgt-default.mk
 unit-tests/deptgt-delete_on_error.exp
 unit-tests/deptgt-delete_on_error.mk
+unit-tests/deptgt-end-fail-all.exp
+unit-tests/deptgt-end-fail-all.mk
+unit-tests/deptgt-end-fail-indirect.exp
+unit-tests/deptgt-end-fail-indirect.mk
+unit-tests/deptgt-end-fail.exp
+unit-tests/deptgt-end-fail.mk
 unit-tests/deptgt-end-jobs.exp
 unit-tests/deptgt-end-jobs.mk
 unit-tests/deptgt-end.exp
@@ -279,6 +297,8 @@ unit-tests/directive-elifnmake.exp
 unit-tests/directive-elifnmake.mk
 unit-tests/directive-else.exp
 unit-tests/directive-else.mk
+unit-tests/directive-endfor.exp
+unit-tests/directive-endfor.mk
 unit-tests/directive-endif.exp
 unit-tests/directive-endif.mk
 unit-tests/directive-error.exp
@@ -287,12 +307,22 @@ unit-tests/directive-export-env.exp
 unit-tests/directive-export-env.mk
 unit-tests/directive-export-gmake.exp
 unit-tests/directive-export-gmake.mk
+unit-tests/directive-export-impl.exp
+unit-tests/directive-export-impl.mk
 unit-tests/directive-export-literal.exp
 unit-tests/directive-export-literal.mk
 unit-tests/directive-export.exp
 unit-tests/directive-export.mk
+unit-tests/directive-for-errors.exp
+unit-tests/directive-for-errors.mk
+unit-tests/directive-for-escape.exp
+unit-tests/directive-for-escape.mk
 unit-tests/directive-for-generating-endif.exp
 unit-tests/directive-for-generating-endif.mk
+unit-tests/directive-for-lines.exp
+unit-tests/directive-for-lines.mk
+unit-tests/directive-for-null.exp
+unit-tests/directive-for-null.mk
 unit-tests/directive-for.exp
 unit-tests/directive-for.mk
 unit-tests/directive-hyphen-include.exp
@@ -315,6 +345,8 @@ unit-tests/directive-include.exp
 unit-tests/directive-include.mk
 unit-tests/directive-info.exp
 unit-tests/directive-info.mk
+unit-tests/directive-misspellings.exp
+unit-tests/directive-misspellings.mk
 unit-tests/directive-sinclude.exp
 unit-tests/directive-sinclude.mk
 unit-tests/directive-undef.exp
@@ -365,10 +397,18 @@ 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/jobs-error-indirect.exp
+unit-tests/jobs-error-indirect.mk
+unit-tests/jobs-error-nested-make.exp
+unit-tests/jobs-error-nested-make.mk
+unit-tests/jobs-error-nested.exp
+unit-tests/jobs-error-nested.mk
 unit-tests/lint.exp
 unit-tests/lint.mk
 unit-tests/make-exported.exp
 unit-tests/make-exported.mk
+unit-tests/meta-cmd-cmp.exp
+unit-tests/meta-cmd-cmp.mk
 unit-tests/moderrs.exp
 unit-tests/moderrs.mk
 unit-tests/modmatch.exp
@@ -447,14 +487,20 @@ unit-tests/opt-include-dir.exp
 unit-tests/opt-include-dir.mk
 unit-tests/opt-jobs-internal.exp
 unit-tests/opt-jobs-internal.mk
+unit-tests/opt-jobs-no-action.exp
+unit-tests/opt-jobs-no-action.mk
 unit-tests/opt-jobs.exp
 unit-tests/opt-jobs.mk
+unit-tests/opt-keep-going-multiple.exp
+unit-tests/opt-keep-going-multiple.mk
 unit-tests/opt-keep-going.exp
 unit-tests/opt-keep-going.mk
 unit-tests/opt-m-include-dir.exp
 unit-tests/opt-m-include-dir.mk
 unit-tests/opt-no-action-at-all.exp
 unit-tests/opt-no-action-at-all.mk
+unit-tests/opt-no-action-runflags.exp
+unit-tests/opt-no-action-runflags.mk
 unit-tests/opt-no-action.exp
 unit-tests/opt-no-action.mk
 unit-tests/opt-query.exp
@@ -491,12 +537,14 @@ unit-tests/posix.exp
 unit-tests/posix.mk
 unit-tests/posix1.exp
 unit-tests/posix1.mk
-unit-tests/qequals.exp
-unit-tests/qequals.mk
 unit-tests/recursive.exp
 unit-tests/recursive.mk
 unit-tests/sh-dots.exp
 unit-tests/sh-dots.mk
+unit-tests/sh-errctl.exp
+unit-tests/sh-errctl.mk
+unit-tests/sh-flags.exp
+unit-tests/sh-flags.mk
 unit-tests/sh-jobs-error.exp
 unit-tests/sh-jobs-error.mk
 unit-tests/sh-jobs.exp
@@ -529,14 +577,22 @@ unit-tests/suff-clear-regular.exp
 unit-tests/suff-clear-regular.mk
 unit-tests/suff-clear-single.exp
 unit-tests/suff-clear-single.mk
+unit-tests/suff-incomplete.exp
+unit-tests/suff-incomplete.mk
 unit-tests/suff-lookup.exp
 unit-tests/suff-lookup.mk
+unit-tests/suff-main-several.exp
+unit-tests/suff-main-several.mk
 unit-tests/suff-main.exp
 unit-tests/suff-main.mk
+unit-tests/suff-phony.exp
+unit-tests/suff-phony.mk
 unit-tests/suff-rebuild.exp
 unit-tests/suff-rebuild.mk
 unit-tests/suff-self.exp
 unit-tests/suff-self.mk
+unit-tests/suff-transform-debug.exp
+unit-tests/suff-transform-debug.mk
 unit-tests/suff-transform-endless.exp
 unit-tests/suff-transform-endless.mk
 unit-tests/suff-transform-expand.exp
@@ -607,6 +663,8 @@ unit-tests/varmod-head.exp
 unit-tests/varmod-head.mk
 unit-tests/varmod-ifelse.exp
 unit-tests/varmod-ifelse.mk
+unit-tests/varmod-indirect.exp
+unit-tests/varmod-indirect.mk
 unit-tests/varmod-l-name-to-value.exp
 unit-tests/varmod-l-name-to-value.mk
 unit-tests/varmod-localtime.exp
@@ -721,6 +779,8 @@ unit-tests/varname-dot-make-ppid.exp
 unit-tests/varname-dot-make-ppid.mk
 unit-tests/varname-dot-make-save_dollars.exp
 unit-tests/varname-dot-make-save_dollars.mk
+unit-tests/varname-dot-makeflags.exp
+unit-tests/varname-dot-makeflags.mk
 unit-tests/varname-dot-makeoverrides.exp
 unit-tests/varname-dot-makeoverrides.mk
 unit-tests/varname-dot-newline.exp
diff --git a/LICENSE b/LICENSE
index 283dd20cccd0..0d460e91d230 100644
--- a/LICENSE
+++ b/LICENSE
@@ -2,11 +2,11 @@ The individual files in this distribution are copyright their
 original contributors or assignees.
 Including:
 
-    Copyright (c) 1993-2020, Simon J Gerraty
+    Copyright (c) 1993-2021, Simon J Gerraty
     Copyright (c) 2020, Roland Illig <rillig at NetBSD.org>
     Copyright (c) 2009-2016, Juniper Networks, Inc.
     Copyright (c) 2009, John Birrell.
-    Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
+    Copyright (c) 1997-2021 The NetBSD Foundation, Inc.
     Copyright (c) 1998 Todd C. Miller <Todd.Miller at courtesan.com>
     Copyright (c) 1989 by Berkeley Softworks
     Copyright (c) 1988, 1989, 1990, 1992, 1993
diff --git a/PSD.doc/tutorial.ms b/PSD.doc/tutorial.ms
index 814a09a62146..da17f950f2b5 100644
--- a/PSD.doc/tutorial.ms
+++ b/PSD.doc/tutorial.ms
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tutorial.ms,v 1.13 2017/03/01 13:05:11 kre Exp $
+.\"	$NetBSD: tutorial.ms,v 1.14 2020/12/18 15:47:34 rillig Exp $
 .\" Copyright (c) 1988, 1989, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1918,15 +1918,15 @@ Suff_FindDeps (jive.c)
 	applying .l -> .c to "jive.l"
 Suff_FindDeps (jive.l)
 Examining jive.l...modified 17:16:01 Oct 4, 1987...up-to-date
-Examining jive.c...non-existent...out-of-date
+Examining jive.c...nonexistent...out-of-date
 --- jive.c ---
 lex jive.l
 \&.\|.\|. meaningless lex output deleted .\|.\|.
 mv lex.yy.c jive.c
-Examining jive.o...non-existent...out-of-date
+Examining jive.o...nonexistent...out-of-date
 --- jive.o ---
 cc -c jive.c
-Examining jive.out...non-existent...out-of-date
+Examining jive.out...nonexistent...out-of-date
 --- jive.out ---
 cc -o jive.out jive.o
 .DE
@@ -2871,7 +2871,7 @@ current directory. While people have suggested that PMake should read
 the directories each time, my experience suggests that the caching seldom
 causes problems. In addition, not caching the directories slows things
 down enormously because of PMake's attempts to apply transformation
-rules through non-existent files \*- the number of extra file-system
+rules through nonexistent files \*- the number of extra file-system
 searches is truly staggering, especially if many files without
 suffixes are used and the null suffix isn't changed from
 .CW .out .
diff --git a/VERSION b/VERSION
index 6dfd755ffdc8..70e0f68a60b0 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
 # keep this compatible with sh and make
-_MAKE_VERSION=20201117
+_MAKE_VERSION=20210110
diff --git a/arch.c b/arch.c
index 81552dee2bb9..037f6bc548cf 100644
--- a/arch.c
+++ b/arch.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: arch.c,v 1.177 2020/11/14 21:29:44 rillig Exp $	*/
+/*	$NetBSD: arch.c,v 1.193 2021/01/09 16:06:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -68,7 +68,8 @@
  * SUCH DAMAGE.
  */
 
-/* Manipulate libraries, archives and their members.
+/*
+ * Manipulate libraries, archives and their members.
  *
  * The first time an archive is referenced, all of its members' headers are
  * read and cached and the archive closed again.  All cached archives are kept
@@ -146,19 +147,19 @@ struct ar_hdr {
 #include "dir.h"
 
 /*	"@(#)arch.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: arch.c,v 1.177 2020/11/14 21:29:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.193 2021/01/09 16:06:09 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
 
-static ArchList *archives;	/* The archives we've already examined */
+static ArchList archives;	/* The archives we've already examined */
 
 typedef struct Arch {
-    char *name;			/* Name of archive */
-    HashTable members;		/* All the members of the archive described
+	char *name;		/* Name of archive */
+	HashTable members;	/* All the members of the archive described
 				 * by <name, struct ar_hdr *> key/value pairs */
-    char *fnametab;		/* Extended name table strings */
-    size_t fnamesize;		/* Size of the string table */
+	char *fnametab;		/* Extended name table strings */
+	size_t fnamesize;	/* Size of the string table */
 } Arch;
 
 static FILE *ArchFindMember(const char *, const char *,
@@ -200,240 +201,244 @@ static int ArchSVR4Entry(Arch *, char *, size_t, FILE *);
 static void
 ArchFree(void *ap)
 {
-    Arch *a = ap;
-    HashIter hi;
-
-    /* Free memory from hash entries */
-    HashIter_Init(&hi, &a->members);
-    while (HashIter_Next(&hi) != NULL)
-	free(hi.entry->value);
-
-    free(a->name);
-    free(a->fnametab);
-    HashTable_Done(&a->members);
-    free(a);
+	Arch *a = ap;
+	HashIter hi;
+
+	/* Free memory from hash entries */
+	HashIter_Init(&hi, &a->members);
+	while (HashIter_Next(&hi) != NULL)
+		free(hi.entry->value);
+
+	free(a->name);
+	free(a->fnametab);
+	HashTable_Done(&a->members);
+	free(a);
 }
 #endif
 
 
 /*
  * Parse an archive specification such as "archive.a(member1 member2.${EXT})",
- * adding nodes for the expanded members to nodeLst.  Nodes are created as
+ * adding nodes for the expanded members to gns.  Nodes are created as
  * necessary.
  *
  * Input:
  *	pp		The start of the specification.
- *	nodeLst		The list on which to place the nodes.
+ *	gns		The list on which to place the nodes.
  *	ctxt		The context in which to expand variables.
  *
  * Output:
  *	return		TRUE if it was a valid specification.
  *	*pp		Points to the first non-space after the archive spec.
- *	*nodeLst	Nodes for the members have been added.
  */
 Boolean
-Arch_ParseArchive(char **pp, GNodeList *nodeLst, GNode *ctxt)
+Arch_ParseArchive(char **pp, GNodeList *gns, GNode *ctxt)
 {
-    char *cp;			/* Pointer into line */
-    GNode *gn;			/* New node */
-    char *libName;		/* Library-part of specification */
-    char *libName_freeIt = NULL;
-    char *memName;		/* Member-part of specification */
-    char saveChar;		/* Ending delimiter of member-name */
-    Boolean expandLibName;	/* Whether the parsed libName contains
+	char *cp;		/* Pointer into line */
+	GNode *gn;		/* New node */
+	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
 				 * variable expressions that need to be
 				 * expanded */
 
-    libName = *pp;
-    expandLibName = FALSE;
-
-    for (cp = libName; *cp != '(' && *cp != '\0';) {
-	if (*cp == '$') {
-	    /*
-	     * Variable spec, so call the Var module to parse the puppy
-	     * so we can safely advance beyond it...
-	     */
-	    const char *nested_p = cp;
-	    void *result_freeIt;
-	    const char *result;
-	    Boolean isError;
-
-	    /* XXX: is expanded twice: once here and once below */
-	    (void)Var_Parse(&nested_p, ctxt, VARE_WANTRES | VARE_UNDEFERR,
-			    &result, &result_freeIt);
-	    /* TODO: handle errors */
-	    isError = result == var_Error;
-	    free(result_freeIt);
-	    if (isError)
-		return FALSE;
-
-	    expandLibName = TRUE;
-	    cp += nested_p - cp;
-	} else
-	    cp++;
-    }
-
-    *cp++ = '\0';
-    if (expandLibName) {
-	(void)Var_Subst(libName, ctxt, VARE_WANTRES | VARE_UNDEFERR, &libName);
-	/* TODO: handle errors */
-	libName_freeIt = libName;
-    }
-
-
-    for (;;) {
-	/*
-	 * First skip to the start of the member's name, mark that
-	 * place and skip to the end of it (either white-space or
-	 * a close paren).
-	 */
-	Boolean doSubst = FALSE; /* TRUE if need to substitute in memName */
-
-	pp_skip_whitespace(&cp);
-
-	memName = cp;
-	while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) {
-	    if (*cp == '$') {
-		/*
-		 * Variable spec, so call the Var module to parse the puppy
-		 * so we can safely advance beyond it...
-		 */
-		void *freeIt;
-		const char *result;
-		Boolean isError;
-		const char *nested_p = cp;
-
-		(void)Var_Parse(&nested_p, ctxt, VARE_WANTRES | VARE_UNDEFERR,
-				&result, &freeIt);
-		/* TODO: handle errors */
-		isError = result == var_Error;
-		free(freeIt);
-
-		if (isError)
-		    return FALSE;
-
-		doSubst = TRUE;
-		cp += nested_p - cp;
-	    } else {
-		cp++;
-	    }
-	}
-
-	/*
-	 * If the specification ends without a closing parenthesis,
-	 * chances are there's something wrong (like a missing backslash),
-	 * so it's better to return failure than allow such things to happen
-	 */
-	if (*cp == '\0') {
*** 48397 LINES SKIPPED ***


More information about the dev-commits-src-all mailing list