Zack Weinberg cffe0a3468 Adjust set size correctly in all cases of m4_set_add_all.
Both the recursive and the iterative versions of m4_set_add_all had a
bug where they did not update the set size correctly if the set
contained tombstones.  I guess m4_set_remove isn’t used that often.
(I found this bug by accident while investigating an unrelated thing.)

The root cause of the bug was that in the tombstone case we had two
different layers quarreling over who got the last word on the size of
the set: m4_set_add, called for each value argument, was updating the
set size for each actual addition, and then the outer expansion of
m4_set_add_all was clobbering those updates with a calculation based
on the number of times the loop evaluated to a ‘-’ character, which
in the tombstone case was always zero.

The fix is to not mess with the set size on each actual addition,
relying on the outer calculation in all cases.  Most of the volume
of the patch is refactoring to eliminate all the duplicate copies of
the “add this element only if it isn’t already there” logic which were
confusing the issue.

I also made m4_set_add_all not go into an infinite loop if invoked
with fewer than two arguments.  Possibly it should error out in this
case instead of silently doing nothing, but I don’t think it matters
very much.

* lib/m4sugar/m4sugar.m4 (_m4_set_add, _m4_set_add_clean):
  New macros, factoring out common “add element to set” logic.
  (m4_set_add): Redefine using _m4_set_add.
  (_m4_set_add_all): Rename to _m4_set_add_all_clean; use _m4_set_add_clean.
  (_m4_set_add_check): Use _m4_set_add, not m4_set_add; emit a string
  of dashes as _m4_set_add_all_clean does.
  (m4_set_add_all): Update to match renamed _m4_set_add_all_clean.
  Do nothing if invoked with fewer than two arguments.

* lib/m4sugar/foreach.m4: Define variants of _m4_set_add_all_clean and
  _m4_set_add_all_check, matching the behavior of the definitions in
  m4sugar.m4.  Do not define m4_set_add_all here.

* tests/m4sugar.at (m4_set): Add more tests of interaction among
  m4_set_add_all, m4_set_remove, and m4_set_size.
2024-07-17 13:16:21 -04:00
2024-06-15 08:27:03 -07:00
2024-04-25 09:14:23 -07:00
2024-07-16 08:26:28 -07:00
2024-04-25 09:14:23 -07:00
2021-01-28 15:19:21 -05:00
2023-01-21 00:58:47 -06:00
2023-01-21 00:58:47 -06:00
2024-01-16 20:20:36 -08:00
2024-04-25 09:14:23 -07:00
2024-07-16 15:56:21 +00:00

-*- text -*-

Autoconf

Autoconf is an extensible package of M4 macros that produce shell
scripts to automatically configure software source code packages.
These scripts can adapt the packages to many kinds of UNIX-like
systems without manual user intervention.  Autoconf creates a
configuration script for a package from a template file that lists the
operating system features that the package can use, in the form of M4
macro calls.

Producing configuration scripts using Autoconf requires GNU M4 and
Perl.  You should install GNU M4 (version 1.4.8 or later is required;
1.4.16 or later is recommended) and Perl (5.006 or later) before
configuring Autoconf, so that Autoconf's configure script can find
them.  The configuration scripts produced by Autoconf are
self-contained, so their users do not need to have Autoconf (or GNU
M4, Perl, etc.).

You can get GNU M4 here:

https://ftp.gnu.org/gnu/m4/

The file INSTALL should be distributed with packages that use
Autoconf-generated configure scripts and Makefiles that conform to the
GNU coding standards.  The package's README can just give an overview
of the package, where to report bugs, and a pointer to INSTALL for
instructions on compilation and installation.  This removes the need
to maintain many similar sets of installation instructions.

Be sure to read BUGS and INSTALL.

Mail suggestions to autoconf@gnu.org, report bugs to
bug-autoconf@gnu.org, and submit patches to autoconf-patches@gnu.org.
All changes can be tracked at the read-only autoconf-commit@gnu.org.
Always include the Autoconf version number, which you can get by
running 'autoconf --version'.  Archives of bug-autoconf@gnu.org can be
found in <https://lists.gnu.org/archive/html/bug-autoconf/>, and
similarly for the other mailing lists.

Licensing
=========
Autoconf is released under the General Public License version 3 (GPLv3+).
Additionally, Autoconf includes a licensing exception in some of its
source files; see the respective copyright notices for how your
project is impacted by including scripts generated by Autoconf, and the
COPYING.EXCEPTION file for the exception in terms of the Additional
Permissions as described in section 7 of GPLv3.

For more licensing information, see
<https://www.gnu.org/licenses/gpl-faq.html> and
<https://www.gnu.org/licenses/exceptions.html>.

For any copyright year range specified as YYYY-ZZZZ in this package
note that the range specifies every single year in that closed interval.

GNU Project notice
==================
Autoconf is part of the GNU Operating System, developed by the GNU Project.

If you are the author of an awesome program and want to join us in
writing Free (libre) Software, please consider making it an official
GNU program and become a GNU Maintainer.  Instructions on how to do
this are here:
  https://www.gnu.org/help/evaluation

Don't have a program to contribute?  Look at all the other ways to help:
  https://www.gnu.org/help/help.html

And to learn more about Free (libre) Software in general, please read
and share this page:
  https://gnu.org/philosophy/free-sw.html

We are looking forward to hacking with you!

-----

Copyright (C) 1992-1994, 1998, 2000-2017, 2020-2024 Free Software
Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without warranty of any kind.
Description
No description provided
Readme 16 MiB
Languages
Roff 42.7%
M4 29.7%
TeX 12%
Perl 9.3%
Makefile 3.5%
Other 2.7%