Code Excluded from Instrumentation
CoverageScanner
does not instrument all C/C++ and C# constructs. Some of them are ignored and others are disabled by default.
Ignored statements
Global variables and static variables
Global variables (assignments outside a function) or static variables are ignored by CoverageScanner. This concerns only boolean expressions that are defined in static or global variables.
Example:
static bool a = true; static bool b = true; static bool c = a && b;
The expression a && b
is ignored by the code coverage analysis and the combinations of values of the variables a
and b
are ignored by the condition coverage analysis (including MCC and MC/DC).
Function parameters
Expressions used as function parameters are generally ignored except for lambda functions.
Example:
foo( a && b );
The expression a && b
is ignored by the code coverage analysis. But the body of a lambda function defined in a function parameter is instrumented.
foo( [](){ return 0; }() );
The return 0;
statement is recorded because it is embedded into a lambda function defined in the function call of foo
.
Boolean expressions as single statement
Boolean expressions used as statements (outside of return
, if
, while
... statement) are ignored. Example:
a && b ; a ? foo() : bar() ;
All these statements are ignored from the decision, condition, MC/DC or MCC analysis.
Instrumentations disabled by default
Empty functions
Functions without code are ignored by default by the instrumentation. Examples are functions that have a body with no statements and constructors without a member initializer list.
To force the instrumentation of these functions, --cs-record-empty-functions
has to be added in the compiler command line arguments.
Coco v7.3.0 ©2024 The Qt Company Ltd.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.