2026-02-06  Eric Blake  <eblake@redhat.com>

	version 1.4.21
	* NEWS: Record release date.

2026-02-06  Eric Blake  <eblake@redhat.com>

	maint: Prepare for release
	'make syntax-check' reported some problems.

	* examples/barem4.m4: Fix typos and pointless trailing space.
	* cfg.mk (exclude_file_name_regexp--sc_trailing_blank): Exempt
	remaining trailing space as intentional.

2026-02-04  Eric Blake  <eblake@redhat.com>

	defn: Be more consistent about defn(builtin) concatenation
	The manual stated that when defn() is used on a builtin, attempts to
	concatenate it with other text produce a warning and omit the builtin.
	This was true for defn(`divnum', `other'), but not for define(`foo',
	defn(`divnum')defn(`other')).  What's more, m4 silently behaved
	differently depending on whether the builtin token was first (the
	definition became a synonym of the builtin, ignoring the rest of the
	text) or second (the defintion used only the text).  All of this is
	confusing to the user, and most portable programs won't be trying to
	concatenate builtin tokens anyways (as other m4 implementations behave
	differently on how builtins are represented in defn).

	* src/macro.c (expand_argument): Warn if a builtin token is used
	with anything else during argument collection.  Drop builtins
	consistently in any context that does not expect them.
	(collect_arguments): Lower groks_macro handling to expand_argument.
	* m4.texi (Defn): Expand the text to cover more cases.
	* NEWS: Document this.
	Reported by Xavier Wang
	<https://mail.gnu.org/archive/html/m4-discuss/2025-08/msg00000.html>

2026-02-03  Eric Blake  <eblake@redhat.com>

	Distribute Doug McIlroy's demonstration of Turing-complete define
	https://www.cs.dartmouth.edu/~doug/barem4.m4 provides an awesome
	demonstration of the power of m4's define macro.  Creative Commons
	Share-alike license is compatible for use here.

	* examples/barem4.m4: New file.
	* examples/testbarem4.m4: Likewise.
	* examples/Makefile.am (EXTRA_DIST): Ship them.
	* examples/COPYING: Disclaim FSF copyright over the new examples.

2026-02-03  Eric Blake  <eblake@redhat.com>

	maint: Update to latest gnulib
	Per a recommendation from Bruno, list gnulib modules in bootstrap.conf
	rather than relying on m4/gnulib-cache.m4.

	* gnulib: Update to latest.
	* bootstrap.conf (gnulib_modules): List modules here,...
	* m4/gnulib-cache.m4: ...not here. Delete this file from version control,
	although it will still be generated by bootstrap.
	* .gitignore: Update to reflect this.

2026-01-25  Paul Eggert  <eggert@cs.ucla.edu>

	doc: mention glibc 2.43 in NEWS

2026-01-20  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	maint: pacify gcc -Wzero-as-null-pointer-constant
	* src/builtin.c (builtin_tab): Use NULL, not 0,
	for null pointers.

	maint: port tests/Makefile.am to current Gnulib
	* tests/Makefile.am (AM_CFLAGS, AM_CXXFLAGS):
	Initialize to empty.

2026-01-11  Eric Blake  <eblake@redhat.com>

	eval: Reject incomplete base prefix
	POSIX is clear that strtol("0x") is an error (there must be digits
	after the explicit base); and other m4 implementations that rely on
	strtol for eval have rejected "eval(0x)".  Although it can be argued
	that rejecting something that used to silently work as 0 in m4 1.4.x
	might break existing scripts, we had never documented it as a feature
	and the risk is low.

	Meanwhile, encountering "eval(08)" is always going to be an error, but
	the code was previously stopping the parse at the first out-of-range
	digit, tokenizing as "0" followed by "8", which produces a semantic
	error when 8 is found when an operator was expected.  However, the
	error message is nicer if we instead trigger the same new error as for
	an incomplete base ["invalid number"] rather than the old way ["bad
	expression in eval (excess input)"]; a future patch may then be able
	to call attention to which substring of the overall expression was
	actually the bad operator or bad number, instead of printing the
	entire expression.  Compare to how bash parses all alphanumerics after
	a leading digit as the token it complains about, even if it detects
	the error earlier in the token.

	* src/eval.c (MIN_PREC): New define to avoid a magic number to
	parse_expr.
	(BADNUM, INVALID_NUMBER): New enum values.  Shuffle values on
	other eval_tokens to keep math consistent.
	(eval_lex): Return BADNUM on failed numeric parse.
	(primary, parse_expr, evaluate): Handle invalid numbers.
	* doc/m4.texi (Eval): Test it.
	* NEWS: Document the bug fix.

	(cherry picked from commit 730e37ab488659fd1fe117054381babee4183eee)

2026-01-11  Eric Blake  <eblake@redhat.com>

	docs: Use @kbd correctly in ignored sections
	Even when @kbd{} is not going to be rendered, it is worth spelling it
	without a bogus space.
	* doc/m4.texi (Improved foreach, Improved copy): Fix spacing.
	* checks/get-them: Tighten regex for kbd lines.

2026-01-11  Eric Blake  <eblake@redhat.com>

	doc: Improve curry example
	Classic lambda calculus defines the Curry function to only apply one
	additional argument; but it is just as easy in m4 to curry an
	arbitrary number of fixed arguments coupled with an arbitrary number
	of extra arguments.  It is also worth documenting how to provide a
	name to a curried function.

	* examples/curry.m4: Accept multiple extra arguments, and improve
	documentation.
	* doc/m4-texi (Composition): Reflect it into the manual.
	Reported-by: Nikolaos Chatzikonstantinou
	https://lists.gnu.org/archive/html/m4-discuss/2025-05/msg00056.html

2026-01-11  Eric Blake  <eblake@redhat.com>

	eval: Fix use of uninitialized variable
	* src/eval.c (parse_expr): Only use u3 when it is set.
	Reported by: David M. Warme.
	Fixes: 881dc481 ("eval: Speed up exponentiation")

	(cherry picked from commit 3271952b45a9d30b067dd82781270e52e5e18e19)

2026-01-11  Eric Blake  <eblake@redhat.com>

	eval: Speed up exponentiation
	Instead of O(n) in the value of the exponent, we can compute exponents
	in O(log n), with exponentiation by squaring.  With this patch, "time
	echo 'eval(3**2000000000)' | m4" drops from 2 seconds to under 10
	milliseconds.

	* src/eval.c (parse_expr): Use exponentiation by squaring.
	* doc/m4.texi (Eval): Test it.

	(cherry picked from commit 881dc481baa282decc134227996000f22fc56358)

2026-01-11  Eric Blake  <eblake@redhat.com>

	eval: Better error message on bad op inside ()
	The eval parser gives up at the first bad operator, but if that
	operator occurs at a place where the parser was expecting a different
	operator (')' or ':'), the error message was confusing, especially if
	that other operator DOES appear later in the line.  Thus, it's better
	to reprioritize the errors to match.

	* src/eval.c (primary): Favor bad op over missing ")".
	(parse_expr): Favor bad op over missing ":".
	* doc/m4.texi (Eval): Test it.
	* THANKS: Update.
	Reported-by: Nikolaos Chatzikonstantinou <nchatz314@gmail.com>

	(cherry picked from commit f01b161f89beb5049c63ff817f16ecbf6a4953a1)

2026-01-11  Eric Blake  <eblake@redhat.com>

	macro: Wipe quote_age after changequote during argument collection
	I recently figured out a way to (ab)use translit/changequote to
	perform O(n) tokenization of a string with a single-byte separator
	when elements of the string do not have to worry about being used
	unquoted (better than naive O(n^2) looping on index/substr or even O(n
	log n) divide-and-conquer substr on halves of the string).

	But while my discovery worked in m4 1.4.19 and with BSD m4, and even
	worked in branch-1.6 if the changequote occurs outside of the
	"requote" call that I added in the manual, it failed on branch-1.6
	with changequote moved later during argument collection, before this
	patch.  It turns out that I stumbled on a scenario where
	argv.quote_age and quote_age() both matched, but still differed from
	the argv->quote_age in place before the translit call, and so I was
	still using `' instead of the new quote characters in the expansion of
	$@.

	Since this regression was never released, it is not worth a NEWS
	entry.
	* src/macro.c (collect_arguments): Wipe quote_age in one more scenario.
	* doc/m4.texi (Changequote): Add a unit test, and document the hack
	that allows O(n) rather than O(n log n) or O(n^2) tokenizing.

	(cherry picked from commit bfd00718b50d252548d5ed4401da2c61e9cb13bb)
	[backport note: Just backport the unit test, to avoid regressions]

2026-01-11  Eric Blake  <eblake@redhat.com>

	maint: Update copyright to include 2026
	Done by running 'make update-copyright'.  Note that the script complained
	about ./bootstrap not recognizing expected patterns; but as that is a
	generated file, it is probably easier to just worry about its copyright
	the next time I bump to newer bootstrap sources.
	* all files: Bump copyright year.

	(cherry picked from commit b78a74954a8bfa1d012e2b209d3ec32c391441b2)

2025-06-05  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2025-05-10  Eric Blake  <eblake@redhat.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 1.4.20
	* NEWS: Record release date.

	maint: Prepare for 1.4.20 release
	* NEWS: Tweak release line before running 'make release-commit'.

	maint: Update to latest gnulib and bootstrap
	* gnulib: Update to latest.
	* gl-mod/bootstrap: Likewise.
	* bootstrap: Regenerate.

2025-04-20  Eric Blake  <eblake@redhat.com>

	builtin: Fewer ARG calls
	The ARG() macro invoves some conditionals and indirection. Anywhere
	the builtin needs to refer to the same argument, it is slightly better
	to grab it up front into a temporary variable.

	* src/builtin (m4_eval, m4_undivert, include, m4_debugmode): Reduce
	calls to ARG.

2025-04-19  Eric Blake  <eblake@redhat.com>

	maint: Ensure stable timestamp for manual
	Git likes to set mtime of files to the point where the working
	directory is checked out, rather than the point where the last content
	of the file was committed.  But Automake likes to populate the
	generated doc/version.texi based on the mtime of doc/m4.texi.  Any
	setup that uses a git checkout of m4 to build a new tarball will thus
	get different contents in the manual if checked out on a different
	date, breaking reproducible builds unless we take measures to
	guarantee that the mtime matches the time of the last commit.

	* configure.ac (st_touch): New code.
	* THANKS: Update.
	Suggested by Simon Josefsson, after a report by Santiago Vila:
	https://lists.gnu.org/archive/html/bug-m4/2025-04/msg00052.html

2025-04-19  Eric Blake  <eblake@redhat.com>

	maint: Drop duplicate check in configure.ac
	Commit e0c743b7 duplicated some code.
	* configure.ac (M4_cv_gcc_pragma_push_works): Only check once.

2025-04-19  Eric Blake  <eblake@redhat.com>

	maint: Update bootstrap and gnulib submodules to latest
	Pick up several fixes that were identified from a recent scratch
	release.

	* gnulib: Bump to latest.
	* gl-lib/bootstrap: Likewise.
	* bootstrap: Regenerate.

2025-04-19  Eric Blake  <eblake@redhat.com>

	tests: Fix typo in get-them script
	Spotted while considering whether to add another '@comment xerr:
	ignore' in the manual.  The bug was introduced in commit f63f456a
	(v1.4.11, 2008), but did not break any tests.

	* checks/get-them: Reset correct variable on an ignored example.

2025-04-14  Eric Blake  <eblake@redhat.com>

	eval: Don't forget division by zero on left side of expr
	Fix a regression introduced in e3c4d07c - when the left half of an
	expression was syntactically valid but computationally undefined, the
	parser was overwriting that status with a successful parse of the
	right half, when the second operator has lower precedence than the
	operator that caused the problem in the left half.  The simplest test
	case is "eval(1/0+1)"; also vulnerable was "eval(1/0||1/0)".

	* src/eval.c (evaluate): Adjust signature, to avoid losing error
	status of left half.
	(primary, evaluate): Update callers.
	* doc/m4.texi (Eval): Test it.

2025-04-13  Eric Blake  <eblake@redhat.com>

	maint: Update library names used by Gnulib.
	* src/Makefile.am (LDADD): Update library names according to Gnulib
	NEWS 2023-01-07, and add missing entries.
	* THANKS: Update.
	Reported by Collin Funk in
	https://lists.gnu.org/archive/html/bug-m4/2025-04/msg00030.html

2025-04-12  Eric Blake  <eblake@redhat.com>

	doc: Be more specific about regexp syntax
	As evidenced by recent gnulib traffic [1], GNU Emacs regexp syntax has
	diverged over time, to the point that RE_SYNTAX_EMACS==0 is no longer
	accurate: modern Emacs has since enabled a\{2\} interval repetition,
	as well as [[:alpha:]] char classes, neither of which is supported in
	current m4.  However, for back-compat reasons, we cannot blindly
	change m4 1.4.x away from syntax 0 even if it is no longer Emacs
	syntax.  Worse, at least Autoconf 2.72 has instances of regex where
	both "{" and "\{" are intended to match a literal "{".  Enabling
	intervals could cause regex that compile now to fail to compile and
	cause a warning, which is a change that can only be done on a major
	version bump to 1.6.  So for now, just document the limitations.  [1]
	https://lists.gnu.org/archive/html/bug-gnulib/2025-04/msg00064.html

	* doc/m4.texi (regexp): Document highlights for users that don't want
	to chase the link, and call out intentional lack of newer features
	in contrast to what Emacs now supports.
	(patsubst): Refer to regexp, rather than Emacs.

2025-04-07  Eric Blake  <eblake@redhat.com>

	maint: Require newer prerequisites
	Gnulib documents that it now requires automake 1.14 or later.  It also
	mentions Autoconf 2.64 or later, but I found it easier to require 2.69
	(released in 2012).

	* configure.ac (AC_PREREQ, AM_INIT_AUTOMAKE): Require newer baselines.
	* HACKING: Document this.

2025-04-07  Eric Blake  <eblake@redhat.com>

	doc: Mention upcoming 1.4.20 release.
	* doc/m4.texi (History): Add this week's activity.

2025-04-06  Eric Blake  <eblake@redhat.com>

	maint: Updates in preparation for release
	* HACKING: Make a few updates to match the latest code base.
	* cfg.mk (local-checks-to-skip): No longer exclude sc_bindtextdomain.
	* THANKS: Add some recent (and not-so-recent) credit.
	* NEWS: Capture a few more items of change.

2025-04-06  Eric Blake  <eblake@redhat.com>

	main: List correct default for -H
	Commit 5cdaf1bc2 (v1.4.18b) missed updating --help output.

	* src/m4.c (usage): Output correct -H default.

2025-04-05  Eric Blake  <eblake@redhat.com>

	maint: Drop BACKLOG
	A file describing unread mails from 30 years ago is not useful now;
	furthermore, version control can still get at this if someone cares.

	* BACKLOG: Delete.
	* README: Drop mention of it.

2025-04-05  Eric Blake  <eblake@redhat.com>

	symtab: Add more debug stats
	No impact to a normal build, but this will help in profiling to decide
	which bottlenecks are worth addressing.

	* src/symtab.c (struct profile) [DEBUG_SYM]: Collect more statistics.
	(profile_strcmp, lookup_symbol): Track more things.
	(show_profile): Adjust output when probing stats.

2025-04-05  Eric Blake  <eblake@redhat.com>

	doc: Tweak previous counter example
	* doc/m4.texi (Incr): Allow for negative seeds.

	doc: Add composite counter example
	* doc/m4.texi (Incr): Document a self-updating counter.
	Suggested by Barry Davidson in
	https://lists.gnu.org/archive/html/bug-m4/2023-08/msg00005.html

	doc: Add composite rquo/lquo example
	* doc/m4.texi (Changequote): Document how to output mismatched
	quotes, with a test added to the testsuite.
	Suggested by Barry Davidson in
	https://lists.gnu.org/archive/html/bug-m4/2023-08/msg00005.html

2025-04-05  Eric Blake  <eblake@redhat.com>

	eval: Overhaul implementation for speed and correctness
	While a recursive descent parser is easy to write, it involves a LOT
	of function calls and boilerplate.  Merely parsing "eval(1)" requires
	descending through ALL 11 levels of operator precedence, only for each
	layer to discover there is no operator.  Better is the Pratt style of
	LR(1) parsing [1], which can handle any grammar where no two
	consecutive non-terminals or epsilon appear in the right side of any
	rule [2].  Now, parsing is done with just two mutually recursive
	functions; "eval(1)" works with just two function calls (primary()
	determines the value, and parse_expr() determines no operators are
	present), while more complicated expressions still produce the correct
	results but with less recursion.

	While at it, I noticed that "eval(1||(1/0))" used to produce a cryptic
	message:

	m4:stdin:1: bad expression in eval (excess input): 1||(1/0)

	despite the similar "eval(1||1/0)" suppressing that as part of
	short-circuiting.  It turns out that my initial implementation of
	short-circuiting in 1.4.8b (back in 2007!) was never fully tested on
	more complex situations.

	To test that the new implementation is indeed faster, I wrote an m4
	solution [3] to an Advent of Code challenge [4] that required
	computing 2000 iterations of a 24-bit linear feedback shift register
	over 2000 input values (--trace shows nearly 20 million eval calls).
	On my machine, runtime with an unoptimized pre-patch m4 was at 78
	seconds, post-patch it completes in 66 seconds.

	[1] https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/
	[2] https://en.wikipedia.org/wiki/Operator-precedence_parser
	[3] https://repo.or.cz/aoc_eblake.git/blob/1b122791d4:/2024/day22.m4
	[4] https://adventofcode.com/2024/day/22

	* NEWS: Document the bug fix. Also document recent compilation fixes.
	* cfg.mk (indent_args): Teach indent not to mangle int casts.
	* doc/m4.text (Eval): Add coverage for the bug fix.  Adjust one
	error output that is now more precise.
	* src/eval.c (logical_or_term, logical_and_term, or_term, xor_term)
	(and_term, equality_term, cmp_term, shift_term, add_term, mult_term)
	(exp_term, unary_term, simple_term): Delete, replaced by...
	(primary, parse_expr): ...new functions.
	(evaluate): Adjust caller.

2025-04-05  Eric Blake  <eblake@redhat.com>

	eval: refactor in preparation for next patch
	* src/eval.c (enum eval_token): Reorder to be in precedence order,
	with values assigned in groups of 10. No semantic impact.

2025-04-05  Eric Blake  <eblake@redhat.com>

	builtin: favor xmemdup0 over xstrdup when length is known
	When the source length is already known, it is faster to copy memory
	without re-scanning for the length.

	* m4/gnulib-cache.m4: Import xmemdup0 module.
	* src/m4.h: Include "xmemdup0.h" for all files.
	* src/builtin.c (define_user_macro): Use it.
	* src/symtab.c (free_symbol, lookup_symbol): Likewise.

2025-04-05  Eric Blake  <eblake@redhat.com>

	symtab: Reduce redundant strlen on macro names
	In many cases, the length of a macro name was previously learned; no
	need to repeat the effort on a strlen.

	* src/m4.h (struct symbol): Add len member.
	(SYMBOL_NAME_LEN): New macro.
	(lookup_symbol, define_user_macro): Update prototypes.
	* src/symtab (lookup_symbol): Update signature to take length.
	(symtab_debug, symtab_print_list): Adjust callers.
	* src/builtin.c (define_user_macro): Update signature to take lengths.
	(define_builtin, builtin_init, define_macro, m4_undefine, m4_popdef)
	(m4_ifdef, m4_dumpdef, m4_indir, m4_defn, set_trace, m4_traceon)
	(m4_traceoff): Adjust callers.
	* src/freeze.c (reload_frozen_state): Likewise.
	* src/m4.c (main): Likewise.
	* src/macro.c (expand_token, collect_arguments): Likewise.

2025-04-05  Eric Blake  <eblake@redhat.com>

	builtin: Reduce use of redundant strlen
	When dealing with tokens, we often know the length of the token from
	the time it was parsed or created by expansion; save this information
	alongside the token instead of calling strlen() everywhere to re-learn
	it, for a slight optimization.  The placement of the new member in
	struct token_data is intentional to avoid changing the size of the
	struct on 64-bit machines, even if the size only matters for text
	tokens.  The code already has a number of places that assume a maximum
	token length bounded by int; scrubbing that to allow a full size_t
	would be a larger patch.

	* src/m4.h (token_data): Add size member.
	(TOKEN_DATA_LEN, SYMBOL_TEXT_LEN): New macros.
	* src/input.c (next_token): Remember size.
	* src/macro.c (expand_argument, collect_arguments): Likewise.
	* src/builtin.c (ARGLEN): New macro.
	(define_user_macro): Set length, and warn user on oversize content.
	(m4_eval): Use compile-time bound for radix.
	(dump_args, m4_ifdef, m4_ifelse, m4_builtin, m4_indir, m4_defn)
	(m4_maketemp, m4_mkstemp, m4_m4wrap, m4_len, m4_substr, m4_translit)
	(m4_regexp, m4_patsubst, expand_user_macro): Utilize known size.

2025-04-05  Eric Blake  <eblake@redhat.com>

	builtin: Reduce use of trivial strlen
	When the length is already known and likely to be short, avoiding the
	function call to strlen can be a slight optimization.  Two obvious
	places: when ntoa() builds a number and already knows where the \0 is,
	and when dumping arguments when the separator is always a single byte.

	* src/builtin:c (dump_args): Change type of sep.
	(m4_shift, m4_errprint, m4_m4wrap, expand_user_macro): Adjust all
	callers.
	(ntoa): Add optional end parameter.
	(shipout_int, m4_eval, m4_maketemp): Adjust all callers.
	* src/debug.c (trace_format): Likewise.
	* src/output.c (shipout_text): Likewise.
	* src/m4.h (ntoa): Adjust prototype.

2025-04-05  Eric Blake  <eblake@redhat.com>

	maint: update to latest gnulib
	* gnulib: Update to latest, which now runs codespell during
	'make syntax-check'.
	* BACKLOG: Typo fix.
	* HACKING: Likewise.
	* Changelog-2014: Swap to UTF-8 spelling of past maintainer names.
	* NEWS: Likewise.
	* cfg.mk (old_NEWS_hash): Run 'make update-NEWS-hash'.
	(exclude_file_name_regexp--sc_codespell, codespell_ignore_words_list):
	New variables to silence codespell false positives.
	* doc/m4.texi (Changeword): Swap example to use 'abc' instead of 'foo'
	so that codespell doesn't complain about 'fo'.

2025-04-05  Eric Blake  <eblake@redhat.com>

	maint: Switch bootstrap to use a submodule
	Upstream development on bootstrap now favors use of a git submodule,
	rather than manually copying in files to the existing gl/ override
	(although gl/ remains available for other gnulib overrides).  Update
	to the newest gnulib, to pull in several fixes.

	* .gitmodules: Add gl-mod/bootstrap as a submodule.
	* gl-mod/bootstrap: New git submodule.
	* bootstrap: Regenerate.
	* m4/gnulib-cache.m4: Likewise.
	* bootstrap.conf (gnulib_non_module_files): Drop.
	(local_gl_path, gnulib_git_submodules): Update to use submodule instead.
	* gl/*: Remove files that used to be hand-copied from bootstrap project.

2025-04-05  Eric Blake  <eblake@redhat.com>

	changeword: Fix coredump on invalid regex
	The docs are clear that the only valid use of the experimental
	changeword is to pass a regex where all prefixes of a desired
	acceptable word are also accepted.  If this constraint is not met, and
	the regex can match a longer string but not the one-byte prefix of
	that string, then the fastmap of that regex will still be set on that
	byte (as it could be a valid anchor to try searching for a longer
	match), but when re_search() then fails to match, we are left with
	garbage in regs.start.

	The docs even had an example where this constraint is not met, but
	because of the way the test was written, the first macro parsed after
	changeword was "dnl", which populated regs with something that happens
	to work on the next attempt to parse with failure to match "f".  But
	the test added here demonstrates that without a prior regex match, if
	the first byte after changeword is in the fastmap but fails to parse,
	then regs.start will still be NULL and crash m4.  And even when m4
	didn't crash, it's still better to only rely on regs after re-running
	the regex on the largest string that did match, rather than whatever
	is left in regs after the first failure to match a one-byte-longer
	string.

	I _really_ want to get rid of changeword.  It slows things down, and
	is a nightmare to maintain.  And the fact that NO ONE reported this
	regression introduced in 2008 (because most distros wisely refuse to
	build with --enable-changeword) means it won't be missed.  But
	removing a feature, even experimental, should be done for 1.6, not
	1.4.x.

	* NEWS: Document the bug fix.  Also a whitespace fix.
	* cfg.mk (old_NEWS_hash): Run 'make update-NEWS-hash'.
	* m4.texi (Changeword): Test for the bug.
	* input.c (word_start) [ENABLE_CHANGEWORD]: Revert commit cde8ed62,
	but this time use a static array rather than malloc'd pointer.
	(set_word_regexp): Populate word_start.
	(peek_token): Use it.
	(next_token): Likewise, and don't use regs.start[1] if regex did not
	have \(\) grouping.

2025-04-04  Eric Blake  <eblake@redhat.com>

	freeze: Open frozen file in binary
	Frozen files must not undergo newline munging.  To support this, teach
	m4_path_search whether a file is okay in text mode (normal m4 input)
	or must be binary (a frozen file).

	* src/m4.h (m4_path_search): Update prototype.
	* src/path.c (m4_fopen, m4_path_search): Honor binary mode.
	* src/builtin.c (m4_undivert, include): Update callers.
	* src/freeze.c (reload_frozen_state): Likewise.
	* src/m4.c (process_file): Likewise.
	Reported by Juan Manuel Guerrero in
	https://lists.gnu.org/archive/html/bug-m4/2023-01/msg00006.html

2025-04-04  Eric Blake  <eblake@redhat.com>

	maint: typo fixes
	* ChangeLog-2014: Address findings from codespell.
	* HACKING: Likewise.
	* NEWS: Likewise.
	* TODO: Likewise.
	* doc/m4.texi: Likewise.
	* examples/hanoi.m4: Likewise.
	* examples/include.m4: Likewise.
	* examples/indir.m4: Likewise.
	* examples/trace.m4: Likewise.
	* src/builtin.c: Likewise.
	* src/debug.c: Likewise.
	* src/output.c: Likewise.
	* cfg.mk: Run 'make update-NEWS-hash'.

	maint: Fix 'make syntax-check' for previous patch
	* doc/Makefile.am (MAKEINFO): Avoid @@ replacement; to avoid
	infinite recursion, we must instead change...
	(AM_MAKEINFOFLAGS): ...this variable.

2025-04-04  Bruno Haible  <bruno@clisp.org>

	build: Ensure that makeinfo ≥ 6.8 checks the @menu structure.
	See <https://lists.gnu.org/archive/html/bug-texinfo/2023-06/msg00015.html>.

	* doc/Makefile.am (MAKEINFO): New variable.

2025-04-04  Bruno Haible  <bruno@clisp.org>

	Fix two occurrences of undefined behaviour.
	* src/path.c (include_env_init): When path_end becomes NULL, terminate
	the loop without computing path_end + 1.
	* src/macro.c (expand_macro): Pass a signed negative value to
	obstack_blank_fast. This avoids a pointer overflow.

2025-04-04  Bruno Haible  <bruno@clisp.org>

	syscmd: Make it work again for most commands on FreeBSD and AIX.
	Regression from 2021-11-19. Fix proposed by Eric Blake.

	* src/builtin.c (m4_syscmd): On Unix, prepend a space to the command before
	executing it.
	(m4_esyscmd): Likewise.

2025-04-04  Eric Blake  <eblake@redhat.com>

	doc: Fix typo in forloop example
	* doc/m4.texi (Improved forloop): s/foreach/forloop/ to match example.
	Reported by Barry Davidson in
	https://lists.gnu.org/archive/html/bug-m4/2023-08/msg00005.html

2025-04-04  Bruno Haible  <bruno@clisp.org>

	build: Fix failure of "./configure; make dist".
	* Makefile.am (BUILT_SOURCES): Add doc/m4.1, checks-files.
	(doc/m4.1): New target.
	(checks-files): New phony target.

2025-04-04  Eric Blake  <eblake@redhat.com>

	maint: Fix build under clang
	Clang also understands '#pragma GCC diagnostic ignored
	"-Wformat-nonliteral"', and refuses to build format.c with -Werror
	without it.
	(Note - even with this patch, a clang build still fails the gnulib
	portion of 'make check' due to a link error in tests/test-gettimeofday;
	that will be fixed in a later patch)

	* src/m4.h: Prefer _GL_GNUC_PREREQ over bare __GNUC__ probes.
	* src/format.c (expand_format): Likewise, and widen scope to
	also appease clang.
	Reported by David Arnstein in:
	https://lists.gnu.org/archive/html/bug-m4/2024-12/msg00002.html

2025-04-03  Eric Blake  <eblake@redhat.com>

	maint: fix 'make syntax-check' errors
	* cfg (indent_args): Inform indent of our no-TAB policy.
	* src/*: Run 'make indent'.
	* src/builtin.c (define_user_macro): Touch up odd split in _()
	by reducing a layer of indentation.
	* src/symtab.c (struct profile): Reformat comment to avoid
	long line from indent.
	* src/input.c (next_char_1): Likewise.
	* src/m4.c (long_options): Likewise.
	(includes): Prefer <error.h> over "error.h".
	* src/m4.h: Likewise for <assert.h>.
	(m4_error, m4_placeholder): Work around indent's inability to
	grok ATTRIBUTE_COLD.
	* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Rename to
	AM_DISTCHECK_CONFIGURE_FLAGS.

2025-04-02  Eric Blake  <eblake@redhat.com>

	doc: better rendering of macros
	texi2any 7.0 added a new feature [1] to allow the elision of the space
	between the macro name and its argument list in a @deffn.  Since m4
	must not have a space there, we want to use it.

	[1] https://lists.gnu.org/archive/html/bug-texinfo/2022-07/msg00086.html

	* doc/m4.texi: Elide space in rendering of macro definitions.
	* bootstrap.conf (buildreq): Require new-enough makeinfo to support it.

2025-04-01  Eric Blake  <eblake@redhat.com>

	maint: Silence compiler false positive
	gcc 14.2.1 warned that output_text() could be calling memcpy() with
	output_cursor NULL and length non-zero, after a call to
	make_room_for().  But this is a false positive: if output_cursor is
	NULL after make_room_for(), it is because the diversion switched over
	to an active output_file.

	* src/output.c (output_text): Add assertion to silence gcc.

2025-01-01  Paul Eggert  <eggert@cs.ucla.edu>

	maint: adjust to Gnulib module renaming

2025-01-01  Paul Eggert  <eggert@cs.ucla.edu>

	Update copyright year
	Since this wasn't done last year, this year I ran:

	  UPDATE_COPYRIGHT_YEAR=2024 make update-copyright
	  make update-copyright

2025-01-01  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest
	* src/builtin.c (m4_syscmd): Adjust to Gnulib API change.

2024-12-02  Bruno Haible  <bruno@clisp.org>

	maint: Avoid a gcc 14 warning that makes --enable-gcc-warnings break.
	* src/output.c: Disable -Wnull-dereference warnings in this file.

2024-08-17  Paul Eggert  <eggert@cs.ucla.edu>

	maint: update POTFILES.in
	* po/POTFILES.in: Remove verror.c.
	Problem reported by Bruno Haible in:
	https://lists.gnu.org/r/bug-gnulib/2024-08/msg00117.html

2024-08-15  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest
	* m4/gnulib-cache.m4: Adjust to match current tool output.
	* src/m4.h: Don't include verror.hl
	(m4_error, m4_error_at_line, m4_placeholder): Now ATTRIBUTE_COLD,
	to pacify gcc with new Gnulib.

2023-01-13  Eric Blake  <eblake@redhat.com>

	output: Avoid tickling UBSAN with memcpy(dest, NULL, 0)
	Even though all libc handle it sanely (because size 0 says there is
	nothing to copy), NULL is not a valid source pointer per a strict
	reading of C, so UBSAN flags it:

	+output.c:511:9: runtime error: null pointer passed as argument 2, which is declared to never be null

	* src/output.c (make_room_for): Skip no-op memcpy.
	Fixes: https://savannah.gnu.org/support/index.php?110809
	Reported-by: Sam James

2023-01-13  Eric Blake  <eblake@redhat.com>

	format: force C locale on floating point
	A minor release is not the time for format(`%.1f', `4.0') to complain
	about 4.0 not being a number followed by outputting "4,0" in locales
	where the decimal point is a comma.  Such a change belongs better in a
	major release where more thought is put into locale-awareness across
	the board.

	* src/m4.c (main): Force LC_NUMERIC to c.
	Reported-by: Bruno Haible in
	https://lists.gnu.org/r/bug-m4/2021-06/msg00021.html

2023-01-13  Eric Blake  <eblake@redhat.com>

	maint: update to latest gnulib
	* gnulib: Update to latest.
	* m4/gnulib-cache.m4: Copyright date is bumped as a result.

2023-01-13  Eric Blake  <eblake@redhat.com>

	symtab: Fix memory corruption when tracing a popdef'd macro
	While debugging a script with 'm4 -daeqt', I was surprised to see
	uninitialized memory in the trace for one of the macro invocations.
	Rerunning it under valgrind confirmed a use-after-free.

	* src/symtab.c (free_symbol): When popdef marks an in-expansion nested
	definition unused, clone its name in case it is being traced.
	(lookup_symbol) [SYMBOL_INSERT]: Consistently use SYMBOL_NAME(), and
	share the name across a symbol stack instead of needing to clone.
	* doc/m4.texi (Undefine): Test this.
	* NEWS: Document the fix.

	Fixes: ee427b83b5 ("symtab: use less memory in pushdef stacks")

2023-01-13  Sam James  <sam@gentoo.org>

	build: Don't add _FORTIFY_SOURCE if already set by user/toolchain
	Newer toolchains (GCC 12+ or Clang 9+, glibc-2.34) allow _FORTIFY_SOURCE=3.

	The current macro used in configure.ac will forcefully downgrade to F_S=2
	and emit a warning if the user set something else:
	```
	x86_64-pc-linux-gnu-gcc -DEXEEXT=\"\" -I. -I../lib  -DIN_M4_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../lib -I./../lib   -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Werror=implicit-function-declaration -Werror=implicit-int -c -o glthread/thread.o glthread/thread.c
	In file included from glthread/thread.c:20:
	../lib/config.h:202: warning: "_FORTIFY_SOURCE" redefined
	  202 |    # define _FORTIFY_SOURCE 2
	      |
	<built-in>: note: this is the location of the previous definition
	```

	See: 390d259efe8e1c7e4b6babb4738fef7427416857
	Message-Id: <20230109080431.1320075-1-sam@gentoo.org>

2023-01-13  Eric Blake  <eblake@redhat.com>

	maint: update bootstrap
	Done via:
	  for f in gl/build-aux/*; do cp ~/bootstrap/build-aux/$(basename $f) $f; done
	  gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap

	* gl/build-aux/*: Sync from upstream.
	* bootstrap: Regenerate.

2023-01-13  Eric Blake  <eblake@redhat.com>

	maint: bump copyright year
	Run 'make update-copyright' for 2023.

2022-01-26  Paul Eggert  <eggert@cs.ucla.edu>

	maint: fix possible NULL dereference
	Problem found by --enable-gcc-warnings.
	* src/m4.h: Include intprops.h.
	* src/output.c (m4_tmpname): Do not assume that xasprintf
	returns non-null pointer.

	maint: omit duplicate include
	* src/format.c: Do not include xvasprintf.h,
	as m4.h does that.

	maint: pacify --enable-gcc-warnings
	* src/symtab.c (lookup_symbol): Reword slightly,
	to work around bug in GCC 11.2.0 when --enable-gcc-warnings.

	maint: bump copyright year
	Run 'make update-copyright' for 2022.

	maint: update gnulib submodule to latest

2022-01-08  Bruno Haible  <bruno@clisp.org>

	Add documentation license into version control.
	This fixes a gnulib-tool warning

	Notice from module fdl-1.3:
	  Don't use this module! Instead, copy the referenced license file into your version control repository.

	* doc/fdl-1.3.texi: New file, from gnulib/doc/fdl-1.3.texi.
	* m4/gnulib-cache.m4: Don't import Gnulib module fdl-1.3.

2022-01-08  Bruno Haible  <bruno@clisp.org>

	Add license into version control.
	This gets rid of an autoreconf warning:

	Makefile.am: installing './COPYING' using GNU General Public License v3 file
	Makefile.am:     Consider adding the COPYING file to the version control system
	Makefile.am:     for your code, to avoid questions about which license your project uses

	* COPYING: New file, copied from gnulib/doc/COPYINGv3.

2021-11-19  Eric Blake  <eblake@redhat.com>

	NEWS: Mention previous syscmd fix
	* NEWS: Add a line.

2021-11-19  Eric Blake  <eblake@redhat.com>

	syscmd: Allow commands with leading - or +
	As POSIX recently pointed out[1], anything with semantics like
	system() or popen() should be passing "--" between "-c" and the user's
	string, in case the user intends to execute a utility beginning with
	'-' or '+'.  POSIX recommends that users should not name files
	beginning with '-', but does not have a similar discouragement against
	files beginning with '+'.  In particular, if your /bin/sh is bash and
	you want m4 to fork to a script named "+O" rather than incorrectly
	printing a list of shopt settings, this patch is essential.  If you
	need to be portable to older m4, you can always prepend a space in
	your arguments to syscmd().

	[1] https://www.austingroupbugs.net/view.php?id=1440

	* src/builtin.c (m4_syscmd, m4_esyscmd): Pass "--" to sh prior to
	user's string.

2021-10-26  Eric Blake  <eblake@redhat.com>

	doc: Fix rendering of dumpdef examples
	doc/m4.texi (tabchar): Fix macro so that @c does not eat rest of line.
	Fix suggested by Patrice Dumas <pertusus@free.fr>
	Reported-by: 4dr14n31t0r Th3 G4m3r <4dr14n31t0r@gmail.com>
	https://lists.gnu.org/archive/html/bug-m4/2021-10/msg00000.html
	Fixes: 81795b2967716

2021-07-12  Eric Blake  <eblake@redhat.com>

	maint: mention another spot to edit on release
	* HACKING: Document how to edit main web page.
	Based on an off-list report by David Apps.

2021-06-01  Eric Blake  <eblake@redhat.com>

	tests: Fix 198.sysval
	In my attempt to avoid test failures on Haiku, I caused test failures
	on platforms where sh is noisy when reporting a killed sub-process.

	* doc/m4.texi (Sysval): Avoid stderr noise during test.
	Fixes: 17011ea76a (tests: Skip signal detection on Haiku)
	Fixes: https://lists.gnu.org/archive/html/bug-m4/2021-05/msg00029.html

2021-05-29  Eric Blake  <eblake@redhat.com>

	doc: Minor formatting tweak.
	* doc/m4.texi (Sysval): Fix overfull /hbox.

	maint: Document another release step.
	* HACKING: Add translation project step.

2021-05-28  Eric Blake  <eblake@redhat.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 1.4.19
	* NEWS: Record release date.

2021-05-28  Eric Blake  <eblake@redhat.com>

	tests: Skip signal detection on Haiku
	On Haiku, using 'kill -9' fromm /bin/shactually causes a process to
	die with the non-standard SIGKILLTHR 15, which causes 198.sysval to
	fail from the unexpected value.

	* doc/m4.texi (Sysval): Skip test on Haiku.
	Reported by Bruno Haible,
	https://lists.gnu.org/archive/html/bug-m4/2021-05/msg00004.html

2021-05-26  Bruno Haible  <bruno@clisp.org>

	Enable more single-thread optimizations in gnulib code
	On many systems (esp. BSD ones), building a recent m4 snapshot produces these
	warnings:

	--------------------------------------------------------------------------------
	  CC       regex.o
	In file included from ../../lib/regex_internal.h:57:0,
	                 from ../../lib/regex.c:70:
	../../lib/regcomp.c: In function 'rpl_regfree':
	../../lib/glthread/lock.h:640:38: warning: statement with no effect [-Wunused-value]
	 # define glthread_lock_destroy(NAME) 0
	                                      ^
	../../lib/regex_internal.h:60:26: note: in expansion of macro 'glthread_lock_destroy'
	 # define lock_fini(lock) glthread_lock_destroy (&(lock))
	                          ^
	...
	--------------------------------------------------------------------------------
	According to the Gnulib documentation section "Optimizations of multithreaded
	code" several more optimizations can be enabled. This patch
	  - enables these single-threading optimizations,
	  - by doing so, gets rid of the warnings in regex.c,
	  - causes no test failures.

	* configure.ac (GNULIB_REGEX_SINGLE_THREAD, GNULIB_MBRTOWC_SINGLE_THREAD,
	GNULIB_WCHAR_SINGLE_LOCALE): Define as C macros.
	Message-Id: <3311608.oHEOCP8NKg@omega>

2021-05-26  Eric Blake  <eblake@redhat.com>

	maint: Update to newer gnulib
	Gnulib has improved stack overflow detection (the c-stack module now
	uses gnulib's stripped-down libsigsegv on more platforms, without
	having to install GNU libsigsegv); with this update, GNU Linux systems
	get stack overflow protection without an external library dependency.
