주요 콘텐츠

Stop analysis if a file does not compile (-stop-if-compile-error)

Specify that a compilation error must stop the analysis

Description

Specify that even a single compilation error must stop the analysis.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select the Environment Settings node and then select this option.

  • Command line and options file: Use the option -stop-if-compile-error. See Command-Line Information.

Why Use This Option

Use this option to first resolve all compilation errors and then perform the Polyspace® analysis. This sequence ensures that all files are analyzed.

Otherwise, only files without compilation errors are fully analyzed. In files containing compilation errors, depending on the nature of the compilation error, some of the functions might not be analyzed:

  • If the compilation error occurs inside a function body, only the remaining functions in the file that do not have compilation errors get analyzed. A stub is used in place of the noncompiling function.

  • If the compilation error occurs in the function signature or outside a function body, depending on the nature of the compilation error, the remaining functions in the file might or might not be analyzed. A stub cannot be generated for a non-compiling function.

The use of stubs instead of actual function definitions can make an analysis less precise. Therefore, you might want to fix all compilation errors first before running a full analysis. The option is more useful for a Code Prover analysis because the Code Prover run-time checks rely more heavily on range propagation across functions.

Settings

On

The analysis stops even if a single compilation error occurs.

You can see the errors in the analysis log, a text file generated during the analysis. The log file is named Polyspace_R20##n_ProjectName_date-time.log and contains lines starting with error: indicating compilation errors. For more information, see View Compilation Errors When Running Polyspace Static Analysis.

Off (default)

The analysis does not stop because of compilation errors, but only files without compilation errors are analyzed. In files containing compilation errors, depending on the nature of the compilation error, some of the functions might be analyzed: If the compilation error occurs inside a function definition, the analysis considers the function undefined. If the analysis needs the definition of such a function, it makes broad assumptions about the function.

  • The function return value can take any value in the range allowed by its data type.

  • The function can modify arguments passed by reference so that they can take any value in the range allowed by their data types.

If the assumptions are too broad, the analysis can be less precise. For instance, a run-time check can flag an operation in orange even though it does not fail in practice.

Command-Line Information

Parameter:-stop-if-compile-error
Default: Off
Example (Bug Finder): polyspace-bug-finder -sources filename -stop-if-compile-error
Example (Code Prover): polyspace-code-prover -sources filename -stop-if-compile-error
Example (Bug Finder Server): polyspace-bug-finder-server -sources filename -stop-if-compile-error
Example (Code Prover Server): polyspace-code-prover-server -sources filename -stop-if-compile-error

Version History

Introduced in R2017a