Re: AS_IF optimization

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[moving to autoconf-patches]

According to Eric Blake on 4/7/2009 7:13 AM:
> According to Andreas Schwab on 4/7/2009 7:01 AM:
>> According to <http://www.in-ulm.de/~mascheck/bourne/> this was fixed in
>> the System III shell.
>
> Which pre-dates shell functions.  Therefore, since AS_IF is part of m4sh,
> which guarantees a shell with functions, can elide empty else statements
> with impunity.  Thanks for the research.

I'm thinking of applying this patch; any objections to the wording?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@xxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkne00oACgkQ84KuGfSFAYCR5wCeJ5TS1DVHUndZwj5GP+huU2EP
p4oAoKrG9dvOX6sHAM7OxR2FG0/Yneok
=Y+rt
-----END PGP SIGNATURE-----
>From a65adc795cbf283604fbf56045e47c8af1a2685c Mon Sep 17 00:00:00 2001
From: Eric Blake <ebb9@xxxxxxx>
Date: Thu, 9 Apr 2009 22:33:37 -0600
Subject: [PATCH] Improve documentation about if exit status.

* doc/autoconf.texi (Limitations of Builtins) <if>: Mention that
exit status bugs don't affect modern targets.
Reported by Andreas Schwab.

Signed-off-by: Eric Blake <ebb9@xxxxxxx>
---
 ChangeLog         |    5 +++++
 doc/autoconf.texi |   10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 071b418..9ac238d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-04-09  Eric Blake  <ebb9@xxxxxxx>

+	Improve documentation about if exit status.
+	* doc/autoconf.texi (Limitations of Builtins) <if>: Mention that
+	exit status bugs don't affect modern targets.
+	Reported by Andreas Schwab.
+
 	Make AS_IF, AS_CASE, and AS_FOR more robust to blank arguments.
 	* lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT, AS_FOR, _AS_IF)
 	(_AS_IF_ELSE, AS_IF): Avoid syntax error on blank argument.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a47d3c8..c3033cd 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15829,7 +15829,8 @@ Limitations of Builtins
 This is especially useful in other M4 macros, where the @dfn{then} and
 @dfn{else} branches might be macro arguments.

-There are shells that do not reset the exit status from an @command{if}:
+Some very old shells did not reset the exit status from an @command{if}
+with no @command{else}:

 @example
 $ @kbd{if (exit 42); then true; fi; echo $?}
@@ -15837,9 +15838,10 @@ Limitations of Builtins
 @end example

 @noindent
-whereas a proper shell should have printed @samp{0}.  This is especially
-bad in makefiles since it produces false failures.  This is why properly
-written makefiles, such as Automake's, have such hairy constructs:
+whereas a proper shell should have printed @samp{0}.  But this is no
+longer a portability problem; any shell that supports functions gets it
+correct.  However, it explains why some makefiles have such hairy
+constructs:

 @example
 if test -f "$file"; then
-- 
1.6.1.2



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

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

  Powered by Linux