[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tracing output [was: 2.62 AT_SETUP limitations]
From: |
Eric Blake |
Subject: |
Re: tracing output [was: 2.62 AT_SETUP limitations] |
Date: |
Thu, 24 Apr 2008 23:18:52 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> Perhaps we could add _m4_bpatsubst as a synonym for m4_bpatsubst, and use
> _m4_bpatsubst anywhere that tracing is dangerous (_m4_split) and
> m4_bpatsubst everywhere else. User code should not be calling
> _m4_bpatsubst, as an undocumented internal macro; the end result would be
> that tracing m4_bpatsubst is less likely to fail, because it no longer
> traces during changed quotes.
I'm thinking about patching along these lines. Before, I get:
$ autoconf --trace m4_bpatsubst --debug
/usr/local/bin/m4:/wintmp/am4t1mDdqr/traces.m4:669: AT_m4_bpatsubst: end of
file in string
...
$ echo $?
0
Ouch - the trace failed, but the exit status doesn't reflect that. Someone
will need to investigate that.
After the patch, I get a valid trace. But as is, this patch then breaks
tracing of m4_builtin, which worked before, so it just moves the problem
around. Also, it slows down the macro m4_split, which is frequently called, in
order to protect the m4_bpatsubst traces. So, any opinions on whether this is
worth pursuing further?
diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4
index 4f86546..f19d2a0 100644
--- a/lib/m4sugar/m4sugar.m4
+++ b/lib/m4sugar/m4sugar.m4
@@ -1745,6 +1745,13 @@ m4_define([m4_toupper],
# that the list contains single space separators, and a common case is
# splitting a single-element list. This macro is called frequently,
# so avoid unnecessary dnl inside the definition.
+#
+# We want to support autom4te --trace m4_bpatsubst, so that a user can
+# track all regular expressions used in their input. However, _m4_split
+# invokes the patsubst builtin with different quoting rules in effect, and
+# the autom4te post-processing falls over when it fails to find matching [].
+# So we use m4_builtin for the real work, which will not be traced,
+# while providing a no-op stub m4_bpatsubst for tracing purposes.
m4_define([m4_split],
[m4_if([$1], [], [],
[$2], [ ], [m4_if(m4_index([$1], [ ]), [-1], [[[$1]]], [_$0($@)])],
@@ -1752,9 +1759,11 @@ m4_define([m4_split],
[_$0($@)])])
m4_define([_m4_split],
+[m4_pushdef([m4_bpatsubst])m4_bpatsubst([$1], [$2], [@:>@, @<:@])]dnl
[m4_changequote([-=<{(],[)}>=-])]dnl
-[[m4_bpatsubst(-=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-,
- -=<{(], [)}>=-)]m4_changequote([, ])])
+[[m4_builtin(-=<{(patsubst)}>=-, -=<{(-=<{($1)}>=-)}>=-, -=<{($2)}>=-,
+ -=<{(], [)}>=-)]m4_changequote([, ])]dnl
+[m4_builtin([popdef], [m4_bpatsubst])])
--
Eric Blake
- Re: 2.62 AT_SETUP limitations, (continued)
- Re: 2.62 AT_SETUP limitations, Noah Misch, 2008/04/22
- Re: 2.62 AT_SETUP limitations, Eric Blake, 2008/04/23
- Re: 2.62 AT_SETUP limitations, Eric Blake, 2008/04/23
- Re: 2.62 AT_SETUP limitations, Joel E. Denny, 2008/04/23
- Re: 2.62 AT_SETUP limitations, Eric Blake, 2008/04/23
- Re: 2.62 AT_SETUP limitations, Ralf Wildenhues, 2008/04/24
- Re: 2.62 AT_SETUP limitations, Eric Blake, 2008/04/24
- Re: 2.62 AT_SETUP limitations, Joel E. Denny, 2008/04/24
- Re: 2.62 AT_SETUP limitations, Akim Demaille, 2008/04/24
- tracing output [was: 2.62 AT_SETUP limitations], Eric Blake, 2008/04/24
- Re: tracing output [was: 2.62 AT_SETUP limitations],
Eric Blake <=
- Re: tracing output, Akim Demaille, 2008/04/25
Re: 2.62 AT_SETUP limitations, Akim Demaille, 2008/04/24
Re: 2.62 AT_SETUP limitations, Joel E. Denny, 2008/04/24