[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07-trace-builtins.patch
From: |
Akim Demaille |
Subject: |
07-trace-builtins.patch |
Date: |
30 Oct 2000 10:20:44 +0100 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
Index: ChangeLog
from Akim Demaille <address@hidden>
GNU M4 1.4 improperly handle the traces of copies of builtins.
* autoconf.sh (task trace): When tracing `BUILTIN' also trace
`m4_BUILTIN'.
Index: autoconf.sh
--- autoconf.sh Thu, 26 Oct 2000 22:29:39 +0200 akim (ace/17_autoconf.s
1.31.8.25 664)
+++ autoconf.sh Sun, 29 Oct 2000 22:54:14 +0100 akim (ace/17_autoconf.s
1.31.8.25 664)
@@ -550,15 +550,63 @@
close("cat >&2")
}
EOF
+
+
# Extract both the m4 program and the m4 options from TRACES.
eval set dummy "$traces"
shift
for trace
do
# The request may be several lines long, hence sed has to quit.
- trace_opt="$trace_opt -t "`echo "$trace" | sed -e 's/:.*//;q'`
- echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
- { (exit 1); exit; }
+ macro_name=`echo "$trace" | sed 's/:.*//;q'`
+ trace_format=`echo "$trace" | sed '1s/^[^:]*://'`
+
+ # GNU M4 1.4's tracing of builtins is buggy. When run on this input:
+ #
+ # | divert(-1)
+ # | changequote([, ])
+ # | define([m4_eval], defn([eval]))
+ # | eval(1)
+ # | m4_eval(2)
+ # | undefine([eval])
+ # | m4_eval(3)
+ #
+ # it behaves this way:
+ #
+ # | % m4 input.m4 -da -t eval
+ # | m4trace: -1- eval(1)
+ # | m4trace: -1- m4_eval(2)
+ # | m4trace: -1- m4_eval(3)
+ # | %
+ #
+ # Conversely:
+ #
+ # | % m4 input.m4 -da -t m4_eval
+ # | %
+ #
+ # So we will merge them, i.e. tracing `BUILTIN' or tracing
+ # `m4_BUILTIN' will be the same: tracing both, but honoring the
+ # *last* trace specification.
+ # FIXME: This is not enough: in the output of `$0' which should
+ # render a unique name, which should be the one specified by the
+ # user.
+ base_name=`echo "$macro_name" | sed 's/^m4_//'`
+ if echo "ifdef(\`$base_name', \`', \`m4exit(-1)')" | m4; then
+ # BASE_NAME is a builtin.
+ trace_opt="$trace_opt -t $base_name -t m4_$base_name"
+ echo "$base_name:$trace_format" |
+ $AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
+ { (exit 1); exit; }
+ echo "m4_$base_name:$trace_format" |
+ $AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
+ { (exit 1); exit; }
+ else
+ # MACRO_NAME is not a builtin.
+ trace_opt="$trace_opt -t $macro_name"
+ echo "$trace" |
+ $AWK -f $tmp/translate.awk >>$tmp/trace.m4 ||
+ { (exit 1); exit; }
+ fi
done
echo "divert(0)dnl" >>$tmp/trace.m4
- 07-trace-builtins.patch,
Akim Demaille <=