]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Remove _m4_index.
authorEric Blake <ebb9@byu.net>
Thu, 13 Nov 2008 04:10:35 +0000 (21:10 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 20 Nov 2008 22:38:57 +0000 (15:38 -0700)
* lib/m4sugar/m4sugar.m4 (_m4_index): Delete; it is more efficient
to make callers guarantee a match.
(m4_init): Adjust caller.
* lib/autoconf/status.m4 (_AC_CONFIG_COMPUTE_DEST): Likewise.
* lib/autoconf/general.m4 (_AC_DEFINE_Q): Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/autoconf/general.m4
lib/autoconf/status.m4
lib/m4sugar/m4sugar.m4

index 1d5fbf5f2f033bb4a700c15d52a852ee6fdcad59..08bb49022f48908571ea89157dc340fd383fd0cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-11-20  Eric Blake  <ebb9@byu.net>
 
+       Remove _m4_index.
+       * lib/m4sugar/m4sugar.m4 (_m4_index): Delete; it is more efficient
+       to make callers guarantee a match.
+       (m4_init): Adjust caller.
+       * lib/autoconf/status.m4 (_AC_CONFIG_COMPUTE_DEST): Likewise.
+       * lib/autoconf/general.m4 (_AC_DEFINE_Q): Likewise.
+
        Describe different hacks for balancing ')' in case statements.
        * doc/autoconf.texi (Limitations of Builtins) <case>: Add an
        exposition on various quoting styles.
index 2f40f82f7b064421a8467f97a69025f38f7163a7..3603cb7fa0486200397d8529296fc221164bfddf 100644 (file)
@@ -2078,9 +2078,10 @@ m4_define([AC_DEFINE_UNQUOTED], [_AC_DEFINE_Q([], $@)])
 # is defined with over-quotation, so that we can avoid m4_defn; this
 # is only safe because the name should not contain $.
 #
-# Use _m4_index to avoid a bug in m4_format in older m4.
+# Guarantee a match in m4_index, so as to avoid a bug with precision
+# -1 in m4_format in older m4.
 m4_define([_AC_DEFINE_Q],
-[m4_pushdef([AC_name], m4_format([[[%.*s]]], _m4_index([$2], [(]), [$2]))]dnl
+[m4_pushdef([AC_name], m4_format([[[%.*s]]], m4_index([$2(], [(]), [$2]))]dnl
 [AC_DEFINE_TRACE(AC_name)]dnl
 [m4_cond([m4_index([$3], [
 ])], [-1], [],
index fe7835832c297340dc64ff658cfe9b9f3b879291..bfd7a79660d78d96b25552022dbb2bdbf1780b73 100644 (file)
@@ -247,9 +247,10 @@ m4_define([_AC_CONFIG_FOOS],
 # _AC_CONFIG_COMPUTE_DEST(STRING)
 # -------------------------------
 # Compute the DEST from STRING by stripping any : and following
-# characters.  Use _m4_index to avoid a bug in m4_format in older m4.
+# characters.  Guarantee a match in m4_index, so as to avoid a bug
+# with precision -1 in m4_format in older m4.
 m4_define([_AC_CONFIG_COMPUTE_DEST],
-[m4_format([[%.*s]], _m4_index([$1], [:]), [$1])])
+[m4_format([[%.*s]], m4_index([$1:], [:]), [$1])])
 
 # _AC_CONFIG_REGISTER(MODE, TAG, [COMMANDS])
 # ------------------------------------------
index 88847147b34e02b2cfeb502c8c8f64195887bf3d..7671f0f5d77a23ce036ec72cbcc6ce8e69728db5 100644 (file)
@@ -625,22 +625,6 @@ m4_define([m4_dumpdefs],
        [m4_map_args([$0], $@)])])
 
 
-# _m4_index(HAYSTACK, NEEDLE)
-# ---------------------------
-# Like the original, except return -2 instead of -1 if NEEDLE is not
-# present in HAYSTACK.  That way, it can be used to work around a bug
-# in m4 1.4.9 and earlier where m4_format did not accept a precision
-# of -1; this macro can be safely used in the idiom:
-#   m4_format([[%.*s]], _m4_index([$1],[$2]), [$1])
-# to grab the prefix of $1 up to but excluding $2, if it was present,
-# otherwise the entire $1.
-m4_define([_m4_index],
-[$0_(m4_index($@))])
-
-m4_define([_m4_index_],
-[m4_if([$1], [-1], [-2], [$1])])
-
-
 # m4_popdef(NAME)
 # ---------------
 # Like the original, except guarantee a warning when using something which is
@@ -2991,8 +2975,7 @@ m4_pattern_forbid([^dnl$])
 
 # If __m4_version__ is defined, we assume that we are being run by M4
 # 1.6 or newer, and thus that $@ recursion is linear and debugmode(d)
-# is available for faster checks of dereferencing undefined macros,
-# and we don't need to worry about _m4_format bugs with _m4_index.
+# is available for faster checks of dereferencing undefined macros.
 # But if it is missing, we assume we are being run by M4 1.4.x, that
 # $@ recursion is quadratic, and that we need foreach-based
 # replacement macros.  Use the raw builtin to avoid tripping up
@@ -3001,7 +2984,6 @@ m4_pattern_forbid([^dnl$])
 m4_ifdef([__m4_version__],
 [m4_debugmode([+d])
 m4_define([m4_defn], _m4_defn([_m4_defn]))
-m4_define([_m4_index], _m4_defn([m4_index]))
 m4_define([m4_popdef], _m4_defn([_m4_popdef]))
 m4_define([m4_undefine], _m4_defn([_m4_undefine]))],
 [m4_builtin([include], [m4sugar/foreach.m4])])