]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi"
authorJim Meyering <meyering@fb.com>
Mon, 27 Jun 2022 05:38:04 +0000 (22:38 -0700)
committerJim Meyering <meyering@fb.com>
Tue, 28 Jun 2022 04:39:24 +0000 (21:39 -0700)
"autoconf quoting is a pain"
* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Its AC_CACHE_CHECK
contains an if/else block, but the closing "fi" lay just after its ")".
Before, this error didn't trigger any failure because the if/else code was
in the "else" block of AC_CACHE_CHECK's AS_IF invocation and AS_IF was also
implemented using an if..fi block. So the ostensibly-"outer" "fi" provided
by AS_IF matched the inner "if/else", and that stray-after-end "fi" served
to close the AS_IF block. However, when AS_IF switched from if..fi to
case..esac, this became a nesting error: no matching "fi".
Initially-harmless error introduced by v2.69-52-gfd29dbd7 in 2012.
Error exposed by v2.72a-30-gc8d6d6eb.
* tests/mktests.pl (scan_m4_files): Do not elide direct test
of AC_FUNC_ALLOCA.

FTR, here's the list of macros whose direct tests were being suppressed:
AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET
AC_CHECK_INCLUDES_DEFAULT AC_DISABLE_OPTION_CHECKING
AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ERTS_VER
AC_ERLANG_SUBST_INSTALL_LIB_DIR AC_ERLANG_SUBST_LIB_DIR AC_F77_DUMMY_MAIN
AC_F77_LIBRARY_LDFLAGS AC_FC_DUMMY_MAIN AC_FC_LIBRARY_LDFLAGS
AC_FUNC_ALLOCA AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_GNU_SOURCE
AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_PATH_X AC_PROG_CPP AC_PROG_CXX
AC_PROG_CXXCPP AC_PROG_F77 AC_PROG_FC AC_PROG_GO AC_PROG_GREP
AC_PROG_OBJC AC_PROG_OBJCPP AC_PROG_OBJCXX AC_PROG_OBJCXXCPP
AC_STRUCT_TM AC_TYPE_GETGROUPS AC_TYPE_LONG_LONG_INT AC_TYPE_MBSTATE_T
AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_USE_SYSTEM_EXTENSIONS

lib/autoconf/functions.m4
tests/mktests.pl

index e7c548468541c617f89288f03f0da1a324d1541e..51aeb0b9273e384ea6e4a502bed6373e32dc7590 100644 (file)
@@ -448,8 +448,10 @@ void *alloca (size_t);
 ]],                               [[char *p = (char *) alloca (1);
                                    if (p) return 0;]])],
                [ac_cv_func_alloca_works=yes],
-               [ac_cv_func_alloca_works=no])])
+               [ac_cv_func_alloca_works=no]
+               )
 fi
+])
 
 if test $ac_cv_func_alloca_works = yes; then
   AC_DEFINE(HAVE_ALLOCA, 1,
index ab47eaf1915c9ca1af1b0cf8417ecf1867b10d52..b68426820ddeb94ea15afef5003d549c4d5220d1 100644 (file)
@@ -290,6 +290,14 @@ sub scan_m4_files
       push @macros_to_test, [ $file, \@ac_macros, \@au_macros ];
     }
 
+  # Do **NOT** filter out AC_FUNC_ALLOCA. Filtering it out
+  # ended up eliding a direct test of AC_FUNC_ALLOCA which
+  # would have exposed a bug, while no required use does so.
+  # Clearing this hash entirely would currently enable direct tests
+  # of 38 macros, but would require designating each that must be
+  # skipped when cross-compiling.
+  delete $required_macros{AC_FUNC_ALLOCA};
+
   # Filter out macros that are AC_REQUIREd by some other macro;
   # it's not necessary to test them directly.
   my @pruned_macros_to_test;