From: Eric Blake Date: Mon, 20 Sep 2010 21:00:28 +0000 (-0600) Subject: autom4te: don't filter out portions of location traces X-Git-Tag: v2.68~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de858e701fe75a7254ef708688ce8fec90945278;p=thirdparty%2Fautoconf.git 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 --- diff --git a/ChangeLog b/ChangeLog index 458343f6..1b47a2c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-20 Eric Blake + + 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 build: support autobuild diff --git a/bin/autom4te.in b/bin/autom4te.in index e1d40e3c..e54aa080 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -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; } } diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index d4401271..282cd797 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -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. diff --git a/tests/m4sugar.at b/tests/m4sugar.at index 900bc3bd..f5182dc9 100644 --- a/tests/m4sugar.at +++ b/tests/m4sugar.at @@ -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