# | 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;
}
}
## ------------- ##
-# _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.
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
]])
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