Contenuto principale

Specify Code Behavior

Specify code behavior such as variable range, library use, and other information to reduce false-positive and false-negative results from a Polyspace® Bug Finder™ analysis

To reduce false-positive and false-negative results, provide additional information about your code. For example:

  • Specify the constraints on elements such as variable ranges and allowed buffer sizes for pointers by using the option Constraint setup (-data-range-specifications).

  • Map the functions in your code to known standard library functions using -code-behavior-specifications.

  • Specify forbidden identifiers or macros in your code by using -code-behavior-specifications.

  • Specify the boundaries of assembly code using the option -asm-begin -asm-end.

  • Specify code that needs to be analyzed differently by using the option -code-behavior-specifications. For example, you can specify code that contains real-time functions, memory management functions, exception handling functions, or critical data members.

  • When analyzing code generated from Simulink® models, specify the parameters, inputs, and step functions to accurately model the data flow.

Use the analysis options listed here to describe your code to Polyspace Bug Finder with greater detail, which can result in improved precision and faster analysis.

Polyspace Options

expand all

Constraint setup (-data-range-specifications)Constrain global variables, function inputs and return values of stubbed functions
Libraries used (-library)Specify libraries that you use in your program
-code-behavior-specificationsAssociate behaviors with code elements such as functions
-classificationControl precisely which files to include in Polyspace analysis and how to analyze them (Since R2023a)
-asm-begin -asm-endExclude compiler-specific asm functions from analysis
Effective boolean types (-boolean-types)Specify data types that coding rule checker must treat as effectively Boolean
Allowed pragmas (-allowed-pragmas)Specify pragma directives that are documented
Functions to stub (-functions-to-stub)Specify functions to stub during analysis
-termination-functionsSpecify process termination functions
Verification time limit (-timeout)Specify a time limit on your analysis
Verify model generated code (-main-generator)Specify that a main function must be generated if it is not present in source files
Parameters (-variables-written-before-loop)Specify variables that the generated main must initialize before the cyclic code loop
Inputs (-variables-written-in-loop)Specify variables that the generated main must initialize in the cyclic code loop
Initialization functions (-functions-called-before-loop)Specify functions that the generated main must call before the cyclic code loop
Step functions (-functions-called-in-loop)Specify functions that the generated main must call in the cyclic code loop
Termination functions (-functions-called-after-loop)Specify functions that the generated main must call after the cyclic code loop

Topics

Provide Additional Information

Specify External Constraints