LCOV_EXCL_START / STOP hat keine Auswirkung bei Verwendung von gcovr

Wenn ich meinem C ++ - Code LCOV_EXCL_START / STOP-Tags hinzufüge, scheint dies keine Auswirkungen auf meinen gcovr-Bericht zu haben.

Weiß jemand, warum dies auftritt?

Ich habe folgendes:

$ tree
.
├── build
├── include
│   └── a.h
└── tests
    └── test_a.cpp

un

$ cat include/a.h 
void f (bool x)
{
    // LCOV_EXCL_START
    if (x)
        throw 1;
    // LCOV_EXCL_STOP
}

un

$ cat tests/test_a.cpp 
#include "a.h"

int main ()
{
    f (false);
    return 0;
}

Aber Linie 5throw 1; ist im gcovr-Bericht enthalten, obwohl es in Ausschluss-Tags eingeschlossen ist:

$ g++ -c -O0 -fprofile-arcs -ftest-coverage -fPIC --coverage -I include ./tests/test_a.cpp -o ./build/test_a.o
$ g++ ./build/test_a.o -o ./build/test_a -lgcov
$ ./build/test_a
$ gcovr -r .
------------------------------------------------------------------------------
                           GCC Code Coverage Report
Directory: .
------------------------------------------------------------------------------
File                                       Lines    Exec  Cover   Missing
------------------------------------------------------------------------------
include/a.h                                    4       3    75%   5
tests/test_a.cpp                               3       3   100%   
------------------------------------------------------------------------------
TOTAL                                          7       6    85%
------------------------------------------------------------------------------

Antworten auf die Frage(2)

Ihre Antwort auf die Frage