Sensitivity context (-context-sensitivity
)
Store call context information to identify function call that caused errors
Description
This option affects a Code Prover analysis only.
Specify the functions for which the verification must store call context information. If the function is called multiple times, using this option helps you to distinguish between the different calls.
Set Option
User interface (desktop products only): In your project configuration, the option is available on the Precision node.
User interface (Polyspace Platform, desktop products only): In your project configuration, the option is on the Static Analysis tab on the Run Time Errors > Precision node.
Command line and options file: Use the option
-context-sensitivity
. See Command-Line Information.
Why Use This Option
Suppose a function is called twice in your code. The check color on each operation in the function body is a combined result of both calls. If you want to distinguish between the colors in the two calls, use this option.
For instance, if a function contains a red or orange check and a green check on the same operation for two different calls, the software combines the contexts and displays an orange check on the operation. If you use this option, the check turns dark orange and the result details show the color of the check for each call.
Settings
Default: none
none
The software does not store call context information for functions.
auto
The software stores call context information for checks in:
Functions that form the leaves of the call tree. These functions are called by other functions, but do not call functions themselves.
Small functions. The software uses an internal threshold to determine whether a function is small.
custom
The software stores call context information for functions that you specify. To enter the name of a function, click .
Tips
If you select this option, you do not see tooltips in the body of the functions that benefit from this option (and keep the call contexts separate).
If you select this option, the analysis can show some code operations in gray (unreachable code) even when you can identify execution paths leading to the operations. In this case, the gray code indicates operations that might be unreachable only in a particular call context.
For instance, suppose this function is called with the arguments -1 and 1 :
If you use the option with this function as argument, there are two unreachable code checks:int isPositive (int num) { if(num < 0) return 0; return 1; }
The check on
if
is gray because when the function is called with argument -1, theif
condition is always true.The check on the code inside the
if
branch is gray because when the function is called with argument 1, theif
condition is always false.
Each unreachable code check indicates code that is unreachable only in a particular call context. You see the call context in the result details.
Command-Line Information
Parameter: -context-sensitivity |
Value:
|
Default: none |
Example (Code Prover): polyspace-code-prover
-sources |
Example (Code Prover
Server):
polyspace-code-prover-server -sources
|
To allow the software to determine which functions receive call
context storage, use the option -context-sensitivity-auto
.