`valac -g`: lcov/gcov shows lines as uncovered even though they executed --- change `#line` for delegates?
Tested with Vala 0.50.1.79-3f2a6 on Lubuntu 20.04 x64. I am reporting here before reporting to lcov/gcov because I think this has to do with how valac picks the line number for #line
directives.
Steps to reproduce:
- Save both of the following files in a directory: foo.vala, Makefile.
- Run
make
- Open
<directory>/coverage/index.html
in a browser - Click on the directory name, then on
foo.vala
.
Expected: All of main()
shows as covered
Observed: Line 9 of main()
does not show as covered even though it executed:
I think this is because, in the generated C code, line 9 is used two different places:
...
static void
_sayHello_void_function (gpointer self)
{
#line 9 "foo.vala" <===========
sayHello ();
#line 29 "foo.c"
}
...
gint
_vala_main (gchar** args,
gint args_length1)
{
...
gint result = 0;
#line 9 "foo.vala" <===========
fn = _sayHello_void_function;
...
I think this might be throwing off lcov/gcov.
In the generated C code, sayHello()
is correctly marked as #line 5 "foo.vala"
. The _sayHello_void_function()
is automatically generated. I think the _sayHello_void_function()
should be identified with its line number in the C file, rather than with the line number of the Vala file that triggered generation of that function. However, I may be missing something --- perhaps this is required for the debug information to be correct for closures or some such.
What say you? Thanks!