| Contents | Index |
While creating your project, you must configure analysis options to match your quality goals.
This includes:
| On this page… |
|---|
Choosing Contextual Verification Options for C Code Choosing Contextual Verification Options for C++ Code |
While creating your project, you must configure analysis options to match your quality goals.
This includes choosing contextual verification options, coding rules, and options to set the strictness of the verification.
Note For information on defining the quality goals for your project, see Defining Quality Goals. |
Polyspace software performs robustness verification by default. If you want to perform contextual verification, there are several options you can use to provide context for data ranges, function call sequence, and stubbing.
For more information on robustness and contextual verification, see Choosing Robustness or Contextual Verification.
Note If you are aware of run-time errors in your code but still want to run a verification, you can annotate your code so that these known errors are highlighted in the Results Manager perspective. For more information, see Annotating Code to Indicate Known Run-Time Errors. |
To specify contextual verification for your project:
In the Configuration pane of the Project Manager perspective, select the All Settings tab.
Expand Polyspace Inner Settings.
Expand the Generate a main and Stubbing options.

To set ranges on variables, use the following options:
Variable/function range setup (-data-range-specifications) — Activates the DRS option, allowing you to set specific data ranges for a list of global variables.
Variables written before loop (-variables-written-before-loop) — Specifies how the generated main initializes global variables.
To specify function call sequence, use the following options:
Functions called before loop (-functions-called-before-loop) — Specifies an initialization function called after initialization of global variables but before the main loop.
Functions called in loop (-functions-called-in-loop) — Specifies how the generated main calls functions.
To control stubbing behavior, use the following options:
No automatic stubbing (-no-automatic-stubbing) — Specifies that the software will not automatically stub functions. The software list the functions to be stubbed and stops the verification.
Stub all functions (-permissive-stubber) — Specifies that the software stubs all functions, including those with function pointers as return type, or those with complex function pointers as parameters.
For more information on these options, see Option Descriptions for C Code in the Polyspace Products for C/C++ Reference.
Polyspace software performs robustness verification by default. If you want to perform contextual verification, there are several options you can use to provide context for data ranges, function call sequence, and stubbing.
For more information on robustness and contextual verification, see Choosing Robustness or Contextual Verification.
Note If you are aware of run-time errors in your code but still want to run a verification, you can annotate your code so that these known errors are highlighted in the Results Manager perspective. For more information, see Annotating Code to Indicate Known Run-Time Errors. |
To specify contextual verification for your project:
In the Configuration pane of the Project Manager perspective, select the All Settings tab.
Expand Polyspace inner Settings.
Expand the Generate a main and Stubbing options.

To set ranges on variables, use the following options:
Variable/function range setup (-data-range-specifications) – Activates the DRS option, allowing you to set specific data ranges for a list of global variables.
Write accesses to global variables (-main-generator-writes-variables) – Specifies how the generated main initializes global variables.
To specify function call sequence, use the following options:
Function calls (-main-generator-calls) – Specifies how the generated main calls functions.
First function to call (-function-called-before-main) – Specifies an initialization function called after initialization of global variables but before the main loop.
To control stubbing behavior, use the following option:
No automatic stubbing (-no-automatic-stubbing) – Specifies that the software will not automatically stub functions. The software list the functions to be stubbed and stops the verification.
For more information on these options, see Options Description in the Polyspace Products for C++ Reference.
Polyspace software provides several options that allow you to customize the strictness of the verification. You should set these options to match the quality goals for your application.
Note If you are aware of run-time errors in your code but still want to run a verification, you can annotate your code so that these known errors are highlighted in the Results Manager perspective. For more information, see Annotating Code to Indicate Known Run-Time Errors. |
To specify the strictness of your verification:
In the Configuration pane of the Project Manager perspective, select the All Settings tab.
Expand Compliance with standards.
Expand the Strict and Permissive options.

In addition, expand Polyspace Inner Settings > Assumptions.
Use the following options to make verification more strict:
Detect overflows on signed and unsigned (-scalar-overflow-checks) — Verification is more strict with overflowing computations on unsigned integers.
Do not consider all global variables to be initialized (-no-def-init-glob) — Verification treats all global variables as non-initialized, therefore causing a red error if they are read before they are written to.
Give all warnings (-wall) — Specifies that all C compliance warnings are written to the log file during compilation.
Strict (-strict) — Specifies strict verification mode, which is equivalent to using the -wall and -no-automatic-stubbing options simultaneously.
Use the following options to make verification more permissive:
Enable pointer arithmetic out of bounds of fields (-allow-ptr-arith-on-struct) — Enables navigation within a structure or union from one field to another.
Allow negative operand for left shifts (-allow-negative-operand-in-shift) — Verification allows a shift operation on a negative number.
Ignore overflowing computations on constants (-ignore-constant-overflows) — Verification is permissive with overflowing computations on constants.
Allow non int types for bitfields (-allow-non-int-bitfield) — Allows you to define types of bitfields other than signed or unsigned int.
Allow undefined global variables (-allow-undef-variables) — Verification does not stop due to errors caused by undefined global variables.
Allow anonymous union/structure fields (-allow-unnamed-fields) — Verification does not stop due to errors caused by unnamed fields in structures.
Ignore missing header files (-ignore-missing-headers) — Verification continues when the software detects that include files are missing.
Dialect support (-dialect) — Verification allows syntax associated with the IAR and Keil dialects.
For more information on these options, see Option Descriptions for C Code in the Polyspace Products for C/C++ Reference.
Polyspace software can check that your code complies with specified coding rules. Before starting code verification, you should consider implementing coding rules, and choose which rules to enforce.
For more information, see Setting Up Project to Check Coding Rules.
Note If you are aware of coding rule violations, but still want to run a verification, you can annotate your code so that these known violations are highlighted in the Results Manager perspective. For more information, see Annotating Code to Indicate Known Coding Rule Violations |
![]() | Creating a Project | Setting Up Project to Check Coding Rules | ![]() |
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |