Skipping uncompiled code

Feb 23, 2016 at 12:05 PM
Hello,

Sorry if the answer is obvious, but I coudn't find it.
Is there a way to remove from the stats the part of the code in a source file that is not compiled?
For ex, if you have compilation switches:
#ifdef FLAG
...
#else
...
#endif
It is obvious that only one part will be exectuded (for a specific compilation). I wonder if the "dead" code can be removed from the stats.

Thanks
Coordinator
Feb 24, 2016 at 4:57 PM
Hello,

I have just run OpenCppCoverage 0.9.4.1 on the following code.
#define TEST
#ifdef TEST
    void foo() {}
#else
    void bar() {}
#endif

int main()
{
    return 0;
}
The function foo is marked as uncovered and the line for function bar is ignored as it should be.
Can you test this code with OpenCppCoverage 0.9.4.1 in debug mode?

If you still have an issue, can you give me a source code that reproduce your issue and your Visual Studio version so that I can investigate?

Hope that help,

OpenCppCoverage
Marked as answer by OpenCppCoverage on 2/24/2016 at 10:36 AM
Feb 24, 2016 at 5:19 PM
Edited Mar 3, 2016 at 2:07 PM
OK thanks. I’m sorry my mistake. Works like a charm. Sorry for losing your time. Regards
Coordinator
Feb 24, 2016 at 5:36 PM
Hello,

No problem, it was fast to answer.

OpenCppCoverage