JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
Some of the code in a function is not exercised by the CodeSonar analysis; the most serious statement type in the unexercised set is a call site.
Warnings of this and other Unexercised Code warning classes typically arise when the setting of configuration parameter SEARCH_BOUND is not high enough to permit all code to be exercised. Increase this setting to reduce these warnings, at the cost of increased analysis time. In most real programs, a search bound high enough to eliminate all Unexercised Code warnings will cause the analysis to take an impractically long time.
Note that these classes are concerned with code coverage rather than path coverage: in some cases it is entirely possible to cover all code in a procedure with a strict subset of the possible paths through that procedure.
| Class Name | Unexercised Call | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | diagnostic | ||||||||||||||||||||||||||||||||||||||||||
| Mnemonic | DIAG.UNEX.CALL | ||||||||||||||||||||||||||||||||||||||||||
| Categories |
|
||||||||||||||||||||||||||||||||||||||||||
| Availability | Available for C and C++. |
||||||||||||||||||||||||||||||||||||||||||
| Enabling | Checks for this warning class are
disabled by default. To enable them, add the following WARNING_FILTER
rule to the project configuration file.
WARNING_FILTER += allow class="Unexercised Call" This class is for analysis diagnostics, rather than for warning about issues in your code. As such, it is generally not enabled by CodeSonar presets. In particular, it is not enabled by the all_warningclasses preset. |
For the sake of compact illustration, we lower the setting of SEARCH_BOUND by adding the following configuration file rule.
SEARCH_BOUND=3
With SEARCH_BOUND=3, CodeSonar will only explore three paths in procedure unex_call(). However, there are four paths through the procedure: if only three paths are explored, one of the switch cases will not be exercised. The most serious statement type in each switch case is a call, so an Unexercised Call warning will be issued at one of those statements. We cannot predict exactly which one from source code alone: it will depend on various phenomena in the CodeSonar build and analysis.
void f(void);
int g(void);
void unex_call(int j)
{
int i=g();
switch( j )
{
case __LINE__: f(); j++; if (i) i=4; return; break; /* 'Unexercised Call' warning issued either here... */
case __LINE__: f(); j++; if (i) i=4; return; break; /* ...or here... */
case __LINE__: f(); j++; if (i) i=4; return; break; /* ...or here... */
default: f(); j++; if (i) i=4; return; break; /* ...or here. */
}
}
The following table lists the Unexercised Code warning classes in order of severity, with the most severe ("Unexercised Call") first. The warning class associated with a block of unexercised code will be the most severe class that is applicable to the statements in the block.
| Warning Class Name | Most Serious Statement Type in Unexercised Set |
|---|---|
| Unexercised Call | A call site. |
| Unexercised Computation | A statement that performs computation (such as addition) on data. |
| Unexercised Conditional | A branch statement, such as if, while, switch, ?, &&,||. |
| Unexercised Data Flow | A simple assignment, or a return statement with a value. |
| Unexercised Control Flow | A non-branching statement that influences control flow, such as break, goto, continue, or return with no value. |
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.