Main Content

Detect uncalled functions (-uncalled-function-checks)

Detect functions that are not called directly or indirectly from main or another entry point function

Description

This option affects a Code Prover analysis only.

Detect functions that are not called directly or indirectly from main or another entry point function during run-time.

A function can be uncalled because of several reasons including the following:

  • The function is actually not called.

  • The call site occurs in dead code.

  • The call site follows a red check. See Code Prover Analysis Following Red and Orange Checks.

  • The call occurs via a function pointer and Polyspace is unable to determine which function it points to.

Set Option

User interface (desktop products only): In your project configuration, the option is on the Check Behavior 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 > Check Behavior node.

Command line and options file: Use the option -uncalled-function-checks. See Command-Line Information.

Why Use This Option

Typically, after verification, the Dashboard pane in the Polyspace user interface shows functions that are not called during verification and therefore not analyzed. However, you do not see them in your analysis results or reports. You cannot comment on them or justify them.

If you want to see these uncalled functions in your analysis results and reports, use this option.

Settings

Default: none

none

The Code Prover analysis excludes checks for uncalled functions.

never-called

The Code Prover analysis checks for functions that are defined but not called.

called-from-unreachable

The Code Prover analysis checks for functions that are defined and called from an unreachable part of the code.

all

The Code Prover analysis checks for functions that are:

  • Defined but not called

  • Defined and called from an unreachable part of the code.

Command-Line Information

Parameter: -uncalled-function-checks
Value: none | never-called | called-from-unreachable | all
Default: none
Example (Code Prover): polyspace-code-prover -sources file_name -uncalled-function-checks all
Example (Code Prover Server): polyspace-code-prover-server -sources file_name -uncalled-function-checks all