Main Content

Common source files (-unit-by-unit-common-source)

Specify files that you want to include with each source file during a file by file verification

Description

This option affects a Code Prover analysis only.

This option is not available for code generated from MATLAB® code or Simulink® models.

For a file by file verification, specify files that you want to include with each source file verification. These files are compiled once, and then linked to each verification.

Set Option

Set the option using one of these methods:

  • Polyspace® user interface (desktop products only): In your project configuration, select the Code Prover Verification node and then enter file paths for this option.

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select the Run Time Errors node and then enter file paths for this option. See Dependencies for other options you must enable first.

  • Command line and options file: Use the option -unit-by-unit-common-source. See Command-Line Information.

Why Use This Option

There are many reasons you might want to verify each source file independently of other files. For instance, if verification of a project takes very long, you can perform a file by file verification to identify which file is slowing the verification.

If you perform a file by file verification, some of your files might be missing information present in the other files. Place the missing information in a common file and use this option to specify the file for verification. For instance, if multiple source files call the same function, use this option to specify a file that contains the function definition or a function stub. Otherwise, Polyspace uses its own stubs for functions that are called but not defined in the source files. The assumptions behind the Polyspace stubs can be broader than what you want, leading to orange checks.

Settings

No Default

Click to add a field. Enter the full path to a file. Otherwise, use the button to navigate to the file location.

Dependencies

This option is enabled only if you select Verify files independently (-unit-by-unit).

Command-Line Information

Parameter: -unit-by-unit-common-source
Value: file1[,file2[,...]]
No Default
Example (Code Prover): polyspace-code-prover -sources file_name -unit-by-unit -unit-by-unit-common-source definitions.c
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -unit-by-unit -unit-by-unit-common-source definitions.c