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 in the unexercised set is a branch statement, such as if, while, switch, ?, &&,||.
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 or eliminate these warnings. 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.
For more information, see Unexercised Call: Note: Unexercised Code Warning Classes.
| Class Name | Unexercised Conditional | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Significance | diagnostic | ||||||||||||||||||||||||||||||||||||||||||
| Mnemonic | DIAG.UNEX.COND | ||||||||||||||||||||||||||||||||||||||||||
| 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 Conditional" 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_cond(). 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 conditional statement, so an Unexercised Conditional 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.
int g(void);
void unex_cond(int j)
{
int i = g();
switch( j )
{
case __LINE__: if (i) i=4; return; break; /* 'Unexercised Conditional' warning issued either here... */
case __LINE__: if (i) i=4; return; break; /* ...or here... */
case __LINE__: if (i) i=4; return; break; /* ...or here... */
default: if (i) i=4; return; break; /* ...or here... */
}
}
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.