Re: the cost of due diligence

Paul Eggert <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
Thanks for fixing that old bug of mine. I installed the attached further 
patch to refactor and simplify. If I'd done it this way originally the 
bug wouldn't have existed.
0001-Refactor-recent-AC_FUNC_ALLOCA-fix.patch (text/x-patch, 1.4 KB)
From 6e3282fe3893a42eb9c5cc4eba5387a3be4e8d10 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 28 Jun 2022 17:10:53 -0500
Subject: [PATCH] Refactor recent AC_FUNC_ALLOCA fix

* lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Simplify and use
AS_IF.  Had I done it this way originally I would have avoided the
bug that Jim just fixed.
---
 lib/autoconf/functions.m4 | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 51aeb0b9..70eb8760 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -426,10 +426,9 @@ if test $ac_cv_working_alloca_h = yes; then
 fi
 
 AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
-[if test $ac_cv_working_alloca_h = yes; then
-  ac_cv_func_alloca_works=yes
-else
-  AC_LINK_IFELSE([AC_LANG_PROGRAM(
+[ac_cv_func_alloca_works=$ac_cv_working_alloca_h
+AS_IF([test "$ac_cv_func_alloca_works" != yes],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM(
 [[#include <stdlib.h>
 #include <stddef.h>
 #ifndef alloca
@@ -447,11 +446,7 @@ void *alloca (size_t);
 #endif
 ]],                               [[char *p = (char *) alloca (1);
 				    if (p) return 0;]])],
-		[ac_cv_func_alloca_works=yes],
-		[ac_cv_func_alloca_works=no]
-		)
-fi
-])
+		[ac_cv_func_alloca_works=yes])])])
 
 if test $ac_cv_func_alloca_works = yes; then
   AC_DEFINE(HAVE_ALLOCA, 1,
-- 
2.36.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.