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
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 select a value 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 select a value for this option. See Dependencies for other options you must enable first.
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
noneThe generated
maindoes not call any function.unusedThe generated
maincalls only those functions that are not called in the source code. It does not call inlined functions.allThe generated
maincalls all functions except inlined ones.customThe generated
maincalls 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
You can use this option only if the option Verify module or library (-main-generator) is selected.
The option is ignored if your code contains a main function.
Tips
Select
unusedwhen you use Code Prover Verification > Verify files independently.If you want the generated
mainto call an inlined function, selectcustomand specify the name of the function.To verify a multitasking application without a main, select
none.The generated
maincan call the functions in arbitrary order. If you want to call your functions in a specific order, manually write amainfunction 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 forgetMaxin 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
|