]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Limitations of Usual Tools) <awk>: `for' on
authorAkim Demaille <akim@epita.fr>
Wed, 6 Dec 2000 15:00:45 +0000 (15:00 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 6 Dec 2000 15:00:45 +0000 (15:00 +0000)
arrays is nondeterministic across AWK implementations.
* tests/tools.at (autoconf: forbidden tokens): Sort the error
message to guarantee its uniqueness.

ChangeLog
doc/autoconf.texi
tests/tools.at

index 89c3a4e8c54034f074a2df608d2584a96bb3b938..7b4ee7e500500ab538d8f982516937035f512513 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-12-06  Akim Demaille  <akim@epita.fr>
+
+       * doc/autoconf.texi (Limitations of Usual Tools) <awk>: `for' on
+       arrays is nondeterministic across AWK implementations.
+       * tests/tools.at (autoconf: forbidden tokens): Sort the error
+       message to guarantee its uniqueness.
+
 2000-12-06  Akim Demaille  <akim@epita.fr>
 
        The SunOS' egrep fails to process properly the `egrep' invocations
index cac52fd75d1c356d6fd006c71ef5f437e6cb4000..4d65bbbf69bcb17e54d010d1fe19d267ca72907d 100644 (file)
@@ -5920,6 +5920,25 @@ $ gawk 'function die () @{ print "Aaaaarg!"  @}
 Aaaaarg!
 @end example
 
+If you want your program to be deterministic, don't depend on @code{for}
+on arrays:
+
+@example
+$ cat for.awk
+END @{
+  arr["foo"] = 1
+  arr["bar"] = 1
+  for (i in arr)
+    print i
+@}
+$ gawk -f for.awk </dev/null
+foo
+bar
+$ nawk -f for.awk </dev/null
+bar
+foo
+@end example
+
 
 @item @command{cat}
 @c ----------------
index cf12babbd4a6c9eb72a4615f5d941fd4e1c18286..85010796b6f67fae22c55d836ef3cb48484d6227 100644 (file)
@@ -186,16 +186,18 @@ AT_CLEANUP
 
 
 
-## ------------------ ##
-## Forbidden tokens.  ##
-## ------------------ ##
+## ---------------------------- ##
+## autoconf: forbidden tokens.  ##
+## ---------------------------- ##
 
-AT_SETUP([Forbidden tokens])
+AT_SETUP([autoconf: forbidden tokens])
 
 AT_DATA([configure.in],
 [[AC_PLAIN_SCRIPT()dnl
 
 # This is allowed in spite of the name.
+# It is on purpose that we check the case where there are several
+# tokens on the same line.
 m4_pattern_allow([^AC_ALLOWED$])
 NOT_AC_ALLOWED AC_ALLOWED AC_ALLOWED_NOT
 
@@ -212,17 +214,20 @@ BAC_DEFINE
 It would be very bad if Autoconf forgot to expand [AC_]OUTPUT!
 ]])
 
-AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 1, [],
-[[configure.in:5: error: undefined macro: NOT_AC_ALLOWED
-configure.in:5: error: undefined macro: AC_ALLOWED_NOT
-configure.in:8: error: undefined macro: FORBIDDEN
-configure.in:12: error: undefined macro: AC_THIS_IS_INVALID
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir 2>err], 1)
+# The output of autoconf is not deterministic here because it
+# uses `for (ind in array)'.  So be sure to have a unique representation.
+AT_CHECK([sort <err], 0,
+[[configure.in:12: error: undefined macro: AC_THIS_IS_INVALID
 configure.in:12: error: undefined macro: AZ_THIS_IS_INVALID_TOO
 configure.in:13: error: undefined macro: ALTHOUGH_AC_THIS_IS
+configure.in:5: error: undefined macro: AC_ALLOWED_NOT
+configure.in:5: error: undefined macro: NOT_AC_ALLOWED
+configure.in:8: error: undefined macro: FORBIDDEN
 configure:16: error: undefined macro: AC_OUTPUT
 ]])
 
-AT_CLEANUP(configure)
+AT_CLEANUP(configure err)