mirror of
git://git.sv.gnu.org/autoconf
synced 2025-02-17 14:01:27 +08:00
Output stack traces in warnings.
* lib/m4sugar/m4sugar.m4 (_m4_warn): New. Replace the former... (m4_warn): Pass the call stack to _m4_warn. * bin/autom4te.in: Adjust to output the call stack. * tests/m4sugar.at (m4@&t@_warn): Adjust.
This commit is contained in:
parent
b9d97d70dc
commit
358bc50517
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2003-08-22 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Output stack traces in warnings.
|
||||
|
||||
* lib/m4sugar/m4sugar.m4 (_m4_warn): New.
|
||||
Replace the former...
|
||||
(m4_warn): Pass the call stack to _m4_warn.
|
||||
* bin/autom4te.in: Adjust to output the call stack.
|
||||
* tests/m4sugar.at (m4@&t@_warn): Adjust.
|
||||
|
||||
2003-08-22 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* lib/Autom4te/Request.pm, lib/Autom4te/C4che.pm: New.
|
||||
|
@ -78,7 +78,7 @@ my %trace;
|
||||
# FIXME: What about `sinclude'?
|
||||
my @preselect = ('include',
|
||||
'm4_pattern_allow', 'm4_pattern_forbid',
|
||||
'm4_warn');
|
||||
'_m4_warn');
|
||||
|
||||
# M4 include path.
|
||||
my @include;
|
||||
@ -993,11 +993,23 @@ handle_m4 ($req, keys %{$req->macro})
|
||||
|
||||
# Issue the warnings each time autom4te was run.
|
||||
handle_traces ($req, "$tmp/warnings",
|
||||
('m4_warn' => "\$1::\$f:\$l::\$2\n\n"));
|
||||
('_m4_warn' => "\$1::\$f:\$l::\$2::\$3\n\n"));
|
||||
# Warnings are separated by 2 \n.
|
||||
for (split (/\n{2,}/, contents ("$tmp/warnings")))
|
||||
{
|
||||
my ($cat, $loc, $msg) = split '::';
|
||||
# The message looks like:
|
||||
# | syntax::input.as:5::ouch
|
||||
# | ::input.as:4: baz is expanded from...
|
||||
# | input.as:2: bar is expanded from...
|
||||
# | input.as:3: foo is expanded from...
|
||||
# | input.as:5: the top level
|
||||
my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4);
|
||||
msg $cat, $loc, "warning: $msg";
|
||||
for (split /\n/, $stacktrace)
|
||||
{
|
||||
my ($loc, $trace) = split (': ', $_, 2);
|
||||
msg $cat, $loc, $trace;
|
||||
}
|
||||
}
|
||||
|
||||
# Now output...
|
||||
|
@ -201,17 +201,29 @@ m4_define([m4_assert],
|
||||
[m4_fatal([assert failed: $1], [$2])])])
|
||||
|
||||
|
||||
|
||||
## ------------- ##
|
||||
## 3. Warnings. ##
|
||||
## ------------- ##
|
||||
|
||||
|
||||
# _m4_warn(CATEGORY, MESSAGE, STACK-TRACE)
|
||||
# ----------------------------------------
|
||||
# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
|
||||
# This is for traces only.
|
||||
# The STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE".
|
||||
m4_define([_m4_warn], [])
|
||||
|
||||
|
||||
# m4_warn(CATEGORY, MESSAGE)
|
||||
# --------------------------
|
||||
# Report a MESSAGE to the autoconf user if the CATEGORY of warnings
|
||||
# is requested (in fact, not disabled). This is for traces only.
|
||||
m4_define([m4_warn], [])
|
||||
|
||||
# Report a MESSAGE to the user if the CATEGORY of warnings is enabled.
|
||||
m4_define([m4_warn],
|
||||
[_m4_warn([$1], [$2],
|
||||
m4_ifdef([m4_expansion_stack],
|
||||
[m4_defn([m4_expansion_stack])
|
||||
m4_location[: the top level]]))
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
@ -42,29 +42,38 @@ AT_SETUP([[m4@&t@_warn]])
|
||||
# warnings. But maybe autom4te should handle that by itself?
|
||||
|
||||
AT_DATA_M4SUGAR([script.4s],
|
||||
[[m4_warn([obsolete], [obsolete])
|
||||
m4_warn([cross], [cross])
|
||||
[[m4_init
|
||||
m4_defun([cross_warning],
|
||||
[m4_warn([cross], [cross])
|
||||
])
|
||||
|
||||
m4_warn([obsolete], [obsolete])
|
||||
cross_warning
|
||||
m4_warn([syntax], [syntax])
|
||||
]])
|
||||
|
||||
AT_CHECK_M4SUGAR([-o-], 0, [],
|
||||
[script.4s:3: warning: syntax
|
||||
[script.4s:8: warning: syntax
|
||||
])
|
||||
|
||||
AT_CHECK_M4SUGAR([-o- -Wall -f], 0, [],
|
||||
[script.4s:1: warning: obsolete
|
||||
script.4s:2: warning: cross
|
||||
script.4s:3: warning: syntax
|
||||
[script.4s:6: warning: obsolete
|
||||
script.4s:7: warning: cross
|
||||
script.4s:4: cross_warning is expanded from...
|
||||
script.4s:7: the top level
|
||||
script.4s:8: warning: syntax
|
||||
])
|
||||
|
||||
AT_CHECK_M4SUGAR([-o- -Wnone,cross -f], 0, [],
|
||||
[script.4s:2: warning: cross
|
||||
[script.4s:7: warning: cross
|
||||
script.4s:4: cross_warning is expanded from...
|
||||
script.4s:7: the top level
|
||||
])
|
||||
|
||||
AT_CHECK_M4SUGAR([-o- -Wnone,cross,error -f], 1, [],
|
||||
[[script.4s:2: error: cross
|
||||
script.4s:2: the top level
|
||||
autom4te: m4 failed with exit status: 1
|
||||
[[script.4s:7: warning: cross
|
||||
script.4s:4: cross_warning is expanded from...
|
||||
script.4s:7: the top level
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
Loading…
Reference in New Issue
Block a user