Functions to call (-main-generator-calls
)
Specify functions that you want the generated main
to
call after the initialization functions
Description
This option affects a Code Prover analysis only.
This option is not available for code generated from MATLAB® code or Simulink® models.
Specify functions that you want the generated main
to call. The
main
calls these functions after the ones you specify through the
option Initialization functions
(-functions-called-before-main)
.
Set Option
User interface (desktop products only): In your project configuration, the option is on the Code Prover Verification node. See Dependencies for other options that you must also enable.
User interface (Polyspace Platform, desktop products only): In your project configuration, the option is on the Static Analysis tab on the Run Time Errors node.
Command line and options file: Use the option
-main-generator-calls
. See Command-Line Information.
Why Use This Option
If you are verifying a module or library, Code Prover generates
a main
function if one does not exist. If a main
exists,
the analysis uses the existing main
.
Use this option along with the option Initialization functions (-functions-called-before-main)
to
specify which functions the generated main
must call. Unless a
function is called directly or indirectly from main
, the software
does not analyze the function.
Settings
Default: unused
none
The generated
main
does not call any function.unused
The generated
main
calls only those functions that are not called in the source code. It does not call inlined functions.all
The generated
main
calls all functions except inlined ones.custom
The generated
main
calls functions that you specify.Enter function names or choose from a list.
Click to add a field and enter the function name.
Click to list functions in your code. Choose functions from the list.
If you use the scope resolution operator to specify the function from a particular namespace, enter the fully qualified name, for instance,
myClass::myMethod(int)
. If the function does not have a parameter, use an empty parenthesis, for instance,myClass::myMethod()
.
Dependencies
This option is available only if you select Verify
module or library (-main-generator)
.
Tips
Select
unused
when you use Code Prover Verification > Verify files independently.If you want the generated
main
to call an inlined function, selectcustom
and specify the name of the function.To verify a multitasking application without a main, select
none
.The generated
main
can call the functions in arbitrary order. If you want to call your functions in a specific order, manually write amain
function to call them.To specify instantiations of templates as arguments, run analysis once with the option argument
all
. Search for the template name in the analysis log and use the template name as it appears in the analysis log for the option argument.For instance, to specify this template function instantiation as option argument:
Run an analysis with the optiontemplate <class T> T GetMax (T a, T b) { T result; result = (a>b)? a : b; return (result); } template int GetMax<int>(int, int); // explicit instantiation
-main-generator-calls all
. Search forgetMax
in the analysis log. You see the function format:To call only this template instantiation, remove the space between the arguments and use the option:T1 getMax<int>(T1, T1)
-main-generator-calls custom="T1 getMax<int>(T1,T1)"
Command-Line Information
Parameter: -main-generator-calls |
Value: none | unused | all | custom= |
Default: unused |
Example (Code Prover): polyspace-code-prover
-sources |
Example (Code Prover
Server):
polyspace-code-prover-server -sources
|
See Also
Verify module or library (-main-generator)
| Initialization functions (-functions-called-before-main)
| Class (-class-analyzer)
| Functions to call within the specified classes
(-class-analyzer-calls)
Topics
- Specify Polyspace Analysis Options
- Verify C Application Without main Function (Polyspace Code Prover)