Main Content

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

User interface (desktop products only): In your project configuration, the option is on the Environment Settings node.

User interface (Polyspace Platform, desktop products only): In your project configuration, the option is on the Static Analysis tab on the Environment Settings node.

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 noncompiling 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.

In the user interface of the Polyspace desktop products, you see the compilation errors on the Output Summary pane.

For information on how to resolve the errors, see Troubleshoot Compilation Errors.

You can also see the errors in the analysis log, a text file generated during the analysis. The log is named Polyspace_R20##n_ProjectName_date-time.log and contains lines starting with Error: indicating compilation errors. To view the log from the analysis results:

  • In the user interface of the Polyspace desktop products, select Window > Show/Hide View > Run Log.

  • In the Polyspace Access web interface or the Polyspace Platform user interface, open the Review perspective. Select Window > Run Log.

Despite compilation errors, you can see some analysis results, for instance, coding rule violations.

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.

If compilation errors occur, in the user interface of the Polyspace desktop products, the Dashboard pane has a link, which shows that some files failed to compile. You can click the link and see the compilation errors on the Output Summary pane.

You can also see the errors in the analysis log, a text file generated during the analysis. The log is named Polyspace_R20##n_ProjectName_date-time.log and contains lines starting with Error: indicating compilation errors. To view the log from the analysis results:

  • In the user interface of the Polyspace desktop products, select Window > Show/Hide View > Run Log.

  • In the Polyspace Access web interface, open the Review tab. Select Window > Run Log.

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