Skip to content

Commit 09cb646

Browse files
committed
Deprecate 'lcov --diff' feature.
The generated result is misleading at best and almost certainly incorrect. "Differential coverage" is a better approach. Signed-off-by: Henry Cox <[email protected]>
1 parent 03b34d8 commit 09cb646

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

bin/lcov

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ eval {
396396
$data_stdout = 0;
397397
list();
398398
} elsif ($diff) {
399+
lcovutil::ignorable_error($lcovutil::ERROR_DEPRECATED,
400+
'"lcov --diff ..." is deprecated and will be removed in a future release. Please see the "differential coverage" section in the genhtml manua for a more flexible alternative.'
401+
);
399402
if (scalar(@ARGV) != 1) {
400403
die("option --diff requires one additional argument!\n" .
401404
"Use $tool_name --help to get usage information\n");

man/lcov.1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ Generate new tracefile from existing tracefile, modifying line numbers as indica
258258
.IR path ]
259259
.br
260260
.RE
261+
.br
262+
.B NOTE: the \-\-diff option is deprecated and will be removed in a subsequent release - see below.
261263
.RE
262264

263265

@@ -700,6 +702,14 @@ Convert coverage data in
700702
using source code diff file
701703
.IR difffile .
702704

705+
.B NOTE THAT THIS FEATURE IS DEPRECATED AND WILL BE REMOVED IN A SUBSEQUENT RELEASE.
706+
The converted coverage data may be misleading at best and is incorrect at worst - for example, inserted or modified code may have changed the reachability of unchanged regions.
707+
Please see the
708+
.I "differential coverage"
709+
section in
710+
.B man(1) genhtml
711+
for a more robust conversion and comparison methodology.
712+
703713
Use this option if you want to merge coverage data from different source code
704714
levels of a program, e.g. when you have data taken from an older version
705715
and want to combine it with data from a more current version.

tests/lcov/diff/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ make -C old || die "Failed to compile old source"
4949
make -C new || die "Failed to compile new source"
5050
diff -u $PWD/old/prog.c $PWD/new/prog.c > diff
5151

52-
$LCOV --diff old/prog.info diff --convert-filenames -o patched.info -t bla || \
52+
$LCOV --diff old/prog.info diff --convert-filenames -o patched.info -t bla --ignore deprecated || \
5353
die "Failed to apply patch to coverage data file"
5454
norminfo new/prog.info > new_normalized.info
5555
norminfo patched.info > patched_normalized.info

0 commit comments

Comments
 (0)