[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: incomplete warning message
From: |
Eric Blake |
Subject: |
Re: incomplete warning message |
Date: |
Mon, 20 Sep 2010 15:10:14 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.3 |
On 09/20/2010 02:59 PM, Ralf Wildenhues wrote:
Since my perl is weak, are there any
suggestions on more robust ways to express this action?
Searching for newlines in the first regex? You want it to be partial
exactly if you print more lines.
It would be easier if I could print an empty warning as the non-partial
line, as in (pseudo-code):
msg $cat, $loc, "warning: "msg", partial => 1;
for (split /\n/, $stacktrace)
{
msg $cat, $loc, $trace, partial => 1;
}
msg $cat, ":0", "";
rather than having to determine on the fly whether $stacktrace is
non-empty, and if so, which $trace of $stacktrace is the last line. Is
that something that Channels.pm already supports, or which could be
added easily?
I'm also working on a testsuite addition, to make sure we don't
regress in the future.
You should try to test both one-line and multi-line messages.
Agreed, and this does it. It covers one-line messages when m4_warn is
called at the top-level, and multi-line messages when m4_warn is called
inside an m4_defun'd macro; this test fails without the autom4te.in
patch shown earlier (the line "script.4s:2: cross_warning is expanded
from..." was eaten), but passes with my first round of the patch:
diff --git a/tests/m4sugar.at b/tests/m4sugar.at
index 900bc3b..f5182dc 100644
--- a/tests/m4sugar.at
+++ b/tests/m4sugar.at
@@ -245,15 +245,14 @@ AT_CLEANUP
AT_SETUP([m4@&address@hidden)
-# 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
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org