autom4te: don't filter out portions of location traces

* bin/autom4te.in (_m4_warn): Pass warnings through the channels
machinery as a single chunk, to avoid partial filtering.
* lib/m4sugar/m4sugar.m4 (_m4_warn): Document the conventions.
* tests/m4sugar.at (m4@&t@_warn): Enhance test to catch this.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2010-09-20 15:00:28 -06:00
parent 842807af6c
commit de858e701f
4 changed files with 36 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2010-09-20 Eric Blake <eblake@redhat.com>
autom4te: don't filter out portions of location traces
* bin/autom4te.in (_m4_warn): Pass warnings through the channels
machinery as a single chunk, to avoid partial filtering.
* lib/m4sugar/m4sugar.m4 (_m4_warn): Document the conventions.
* tests/m4sugar.at (m4@&t@_warn): Enhance test to catch this.
Reported by Bruno Haible.
2010-09-17 Eric Blake <eblake@redhat.com>
build: support autobuild

View File

@ -1021,12 +1021,15 @@ for (split (/\n*$separator\n*/o, contents ("$tmp/warnings")))
# | input.as:2: bar is expanded from...
# | input.as:3: foo is expanded from...
# | input.as:5: the top level
# In particular, m4_warn guarantees that either $stackdump is empty, or
# it consists of lines where only the last line ends in "top level".
my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4);
msg $cat, $loc, "warning: $msg";
msg $cat, $loc, "warning: $msg",
partial => ($stacktrace =~ /top level$/) + 0;
for (split /\n/, $stacktrace)
{
my ($loc, $trace) = split (': ', $_, 2);
msg $cat, $loc, $trace;
msg $cat, $loc, $trace, partial => ($trace !~ /top level$/) + 0;
}
}

View File

@ -231,11 +231,12 @@ m4_define([m4_assert],
## ------------- ##
# _m4_warn(CATEGORY, MESSAGE, STACK-TRACE)
# ----------------------------------------
# _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".
# If present, STACK-TRACE is a \n-separated list of "LOCATION: MESSAGE",
# where the last line (and no other) ends with "the top level".
#
# Within m4, the macro is a no-op. This macro really matters
# when autom4te post-processes the trace output.

View File

@ -245,15 +245,14 @@ AT_CLEANUP
AT_SETUP([m4@&t@_warn])
# FIXME: For the time being we use -f to make sure we do issue the
# warnings. But maybe autom4te should handle that by itself?
AT_DATA_M4SUGAR([script.4s],
[[m4_init
m4_defun([cross_warning], [m4_warn([cross], [cross])])
m4_defun([cross_warning], [m4_warn([cross], [cross])])
m4_divert([0])dnl
m4_warn([obsolete], [obsolete])dnl
m4_warn([obsolete], [obsolete])dnl
cross_warning[]dnl
m4_warn([syntax], [syntax])dnl
cross_warning[]dnl
m4_warn([syntax], [syntax])dnl
]])
@ -261,27 +260,38 @@ m4_warn([syntax], [syntax])dnl
AT_CHECK_M4SUGAR([-o-], 0, [],
[script.4s:4: warning: prefer named diversions
script.4s:7: warning: syntax
script.4s:9: warning: syntax
])
AT_CHECK_M4SUGAR([-o- -Wall -f], 0, [],
AT_CHECK_M4SUGAR([-o- -Wall], 0, [],
[script.4s:4: warning: prefer named diversions
script.4s:5: warning: obsolete
script.4s:6: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:6: the top level
script.4s:7: warning: syntax
script.4s:8: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:8: the top level
script.4s:9: warning: syntax
])
AT_CHECK_M4SUGAR([-o- -Wnone,cross -f], 0, [],
AT_CHECK_M4SUGAR([-o- -Wnone,cross], 0, [],
[script.4s:6: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:6: the top level
script.4s:8: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:8: the top level
])
AT_CHECK_M4SUGAR([-o- -Wnone,cross,error -f], 1, [],
AT_CHECK_M4SUGAR([-o- -Wnone,cross,error], 1, [],
[[script.4s:6: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:6: the top level
script.4s:8: warning: cross
script.4s:2: cross_warning is expanded from...
script.4s:8: the top level
]])
AT_CLEANUP