Re: [PATCH] bug fixes for AS_IF and _AC_LANG_COMPILER_GNU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/14/20 7:31 AM, Jannick wrote:

- AS_IF: cope with blank false branch.
- _AC_LANG_COMPILER_GNU: make cached result available to calling macro.

Thanks, I installed the _AC_LANG_COMPILER_GNU patch into the master branch on savannah. However, the AS_IF patch causes 'make check' to fail, because tests/compile.at's AC_RUN_IFELSE test does this:

AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 2])],
	      [AC_MSG_ERROR([saw `return 2' as a success])],
	      [estatus=$?
test $estatus != 2 &&
  AC_MSG_ERROR([did not get as 2 exit status: $estatus])])

and because the AS_IF patch inserts ":" between the "else" and the "estatus=$?", the ":" sets $? to 0 and makes the test fail. So I did not install that patch.

Autoconf's nblank macros don't test whether the argument eventually expands to just blanks; it tests whether the argument currently consists of just blanks. So I think we'll just have to advise people to write [] instead of [[]] when they want the empty string. The Autoconf manual already contains a couple of examples illustrating why [] and [[]] are not the same thing, so I added one more example by installing the attached documentation patch.
>From b19b5e7d81022523073cacf8d0c65cd7434dc773 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@xxxxxxxxxxx>
Date: Fri, 10 Jul 2020 13:42:26 -0700
Subject: [PATCH] Document AS_IF(..., ..., [[]]) glitch

* doc/autoconf.texi (Common Shell Constructs):
Note the if-false arg problem reported by Jannick in:
https://lists.gnu.org/r/autoconf/2020-03/msg00045.html
---
 doc/autoconf.texi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 594547c0..f4520bba 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13750,6 +13750,13 @@ AS_IF([test "x$foo" = xyes], [HANDLE_FOO([yes])],
 @noindent
 ensures any required macros of @code{HANDLE_FOO}
 are expanded before the first test.
+
+The @var{run-if-false} argument should either consist entirely of
+blanks, or expand to a nonempty shell command.  For example,
+@code{AS_IF([:], [:], [[]])} is invalid because its @var{run-if-false}
+argument contains the nonblank characters @code{[]} which expand to
+nothing.  This restriction on @var{run-if-false} also applies to other
+macros with ``if-false'' arguments denoting shell commands.
 @end defmac
 
 @defmac AS_MKDIR_P (@var{file-name})
-- 
2.17.1


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux