Main Content

polyspace.ModelLinkOptions Properties

Customize Polyspace analysis of generated code with options object properties

To customize your Polyspace® analysis of generated code, modify the polyspace.ModelLinkOptions object properties. Each property corresponds to an analysis option on the Configuration pane in the Polyspace user interface.

The properties are grouped using the same categories as the Configuration pane. This page only shows what values each property can take. For details about:

Each property description below also highlights if the option affects only one of Bug Finder or Code Prover.

Note

Some options might not be available depending on the language setting of the object. You can set the source code language (Language) to 'C', 'CPP' or 'C-CPP' during object creation, but cannot change it later.

Advanced

expand all

Additional flags for analysis specified as a character vector.

For more information, see Other.

Example: opts.Advanced.Additional = '-extra-flags -option -extra-flags value'

Command or script software should execute after analysis finishes, specified as a character vector.

For more information, see Command/script to apply after the end of the code verification (-post-analysis-command).

Example: opts.Advanced.PostAnalysisCommand = '"C:\Program Files\perl\win32\bin\perl.exe" "C:\My_Scripts\send_email"'

BugFinderAnalysis (Affects Bug Finder Only)

expand all

This property affects Bug Finder analysis only.

List of custom checkers to activate specified by using the name of a polyspace.DefectsOptions object or a cell array of defect acronyms. To use this custom list in your analysis, set CheckersPreset to custom.

For more information, see polyspace.DefectsOptionspolyspace.DefectsOptions.

Example: defects = polyspace.DefectsOptions; opts.BugFinderAnalysis.CheckersList = defects

Example: opts.BugFinderAnalysis.CheckersList = {'INT_ZERO_DIV','FLOAT_ZERO_DIV'}

This property affects Bug Finder analysis only.

Preset checker list, specified as a character vector of one of the preset options: 'default', 'all',or 'custom'. To use 'custom', specify a value for the property BugFinderAnalysis.CheckersList.

For more information, see Find defects (-checkers).

Example: opts.BugFinderAnalysis.CheckersPreset = 'all'

This property affects Bug Finder analysis only.

Activate stricter checks that consider all possible value for:

  • Global variables.

  • Reads of volatile variables.

  • Returns of stubbed functions.

  • Inputs to functions specified with SystemInputsFrom.

The analysis considers all possible values for a subset of Numerical and Static memory defects.

This property is equivalent to the Run stricter checks considering all values of system inputs check box in the Polyspace interface.

For more information, see Run stricter checks considering all values of system inputs (-checks-using-system-input-values).

Example: opts.BugFinderAnalysis.ChecksUsingSystemInputValues = true

This property affects Bug Finder analysis only.

Activate defect checking, specified as true or false. Setting this property to false disables all defects. If you want to disable defect checking but still get results, turn on coding rules checking or code metric checking.

This property is equivalent to the Find defects check box in the Polyspace interface.

Example: opts.BugFinderAnalysis.EnableCheckers = false

This property affects Bug Finder analysis only.

Functions for which you want to run stricter checks that consider all possible values of the function inputs. Specify the list of functions as 'auto', 'uncalled', 'all', or as a character array beginning with custom= followed by a comma-separated list of function names.

To enable this option, set BugFinderAnalysis.ChecksUsingSystemInputValues = true.

For more information, see Consider inputs to these functions (-system-inputs-from).

Example: opts.BugFinderAnalysis.SystemInputsFrom = 'custom=foo,bar'

ChecksAssumption (Affects Code Prover Only)

expand all

This property affects Code Prover analysis only.

Allow left shift operations on a negative number, specified as true or false.

For more information, see Allow negative operand for left shifts (-allow-negative-operand-in-shift) (Polyspace Code Prover).

Example: opts.ChecksAssumption.AllowNegativeOperandInShift = true

This property affects Code Prover analysis only.

Incorporate infinities and/or NaNs, specified as true or false.

For more information, see Consider non finite floats (-allow-non-finite-floats) (Polyspace Code Prover).

Example: opts.ChecksAssumption.AllowNonFiniteFloats = true

This property affects Code Prover analysis only.

Allow arithmetic on pointer to a structure field so that it points to another field, specified as true or false.

For more information, see Enable pointer arithmetic across fields (-allow-ptr-arith-on-struct) (Polyspace Code Prover).

Example: opts.ChecksAssumption.AllowPtrArithOnStruct = true

This property affects Code Prover analysis only.

Detect floating-point operations that result in infinities.

To activate this option, specify ChecksAssumption.AllowNonFiniteFloats.

For more information, see Infinities (-check-infinite) (Polyspace Code Prover).

Example: opts.ChecksAssumption.CheckInfinite = 'forbid'

This property affects Code Prover analysis only.

Detect floating-point operations that result in NaN-s.

To activate this option, specify ChecksAssumption.AllowNonFiniteFloats.

For more information, see NaNs (-check-nan) (Polyspace Code Prover).

Example: opts.ChecksAssumption.CheckNan = 'forbid'

This property affects Code Prover analysis only.

Detect operations that result in subnormal floating point values.

For more information, see Subnormal detection mode (-check-subnormal) (Polyspace Code Prover).

Example: opts.ChecksAssumption.CheckSubnormal = 'forbid'

This property affects Code Prover analysis only.

Find cases where a function returns a pointer to one of its local variables, specified as true or false.

For more information, see Detect stack pointer dereference outside scope (-detect-pointer-escape) (Polyspace Code Prover).

Example: opts.ChecksAssumption.DetectPointerEscape = true

This property affects Code Prover analysis only.

Disable checks for noninitialized variables and pointers, specified as true or false.

For more information, see Disable checks for non-initialization (-disable-initialization-checks) (Polyspace Code Prover).

Example: opts.ChecksAssumption.DisableInitializationChecks = true

This property affects Code Prover analysis only.

Allow type mismatch between function pointers and the functions they point to, specified as true or false.

For more information, see Permissive function pointer calls (-permissive-function-pointer) (Polyspace Code Prover).

Example: opts.ChecksAssumption.PermissiveFunctionPointer = true

This property affects Code Prover analysis only.

Enable the check for signed integer overflows and the assumptions to make following an overflow specified as 'forbid', 'allow', or 'warn-with-wrap-around'.

For more information, see Overflow mode for signed integer (-signed-integer-overflows) (Polyspace Code Prover).

Example: opts.ChecksAssumption.SignedIntegerOverflows = 'warn-with-wrap-around'

This property affects Code Prover analysis only.

Allow a pointer with insufficient memory buffer to point to a structure, specified as true or false.

For more information, see Allow incomplete or partial allocation of structures (-size-in-bytes) (Polyspace Code Prover).

Example: opts.ChecksAssumption.SizeInBytes = true

This property affects Code Prover analysis only.

Detect functions that are not called directly or indirectly from main or another entry-point function, specified as 'none', 'never-called', 'called-from-unreachable', or 'all'.

For more information, see Detect uncalled functions (-uncalled-function-checks) (Polyspace Code Prover).

Example: opts.ChecksAssumption.UncalledFunctionCheck = 'all'

This property affects Code Prover analysis only.

Enable the check for unsigned integer overflows and the assumptions to make following an overflow, specified as 'forbid', 'allow', or 'warn-with-wrap-around'.

For more information, see Overflow mode for unsigned integer (-unsigned-integer-overflows) (Polyspace Code Prover).

Example: opts.ChecksAssumption.UnsignedIntegerOverflows = 'allow'

CodeProverVerification (Affects Code Prover only)

expand all

This property affects Code Prover analysis only.

Classes that you want to verify, specified as 'all', 'none', or as a character array beginning with custom= followed by a comma-separated list of class names.

For more information, see Class (-class-analyzer) (Polyspace Code Prover).

Example: opts.CodeProverVerification.ClassAnalyzer = 'none'

This property affects Code Prover analysis only.

Functions that the generated main must call after the cyclic code loop, specified as a cell array of function names.

For more information, see Termination functions (-functions-called-after-loop).

Example: opts.CodeProverVerification.FunctionsCalledAfterLoop = {'func1','func2'}

This property affects Code Prover analysis only.

Model Link only. Functions that the generated main must call before the cyclic code loop, specified as a cell array of function names.

For more information, see Initialization functions (-functions-called-before-loop)).

Example: opts.CodeProverVerification.FunctionsCalledBeforeLoop = {'func1','func2'}

This property affects Code Prover analysis only.

Functions that the generated main must call in the cyclic code loop, specified as 'none', 'all', or as a character array beginning with custom= followed by a comma-separated list of function names..

For more information, see Step functions (-functions-called-in-loop).

Example: opts.CodeProverVerification.FunctionsCalledInLoop = 'all'

This property affects Code Prover analysis only.

Generate a main function if it is not present in source files, specified as true or false.

For more information, see Verify module or library (-main-generator).

Example: opts.CodeProverVerification.MainGenerator = false

This property affects Code Prover analysis only.

Variables that the generated main must initialize before the cyclic code loop, specified as 'none', 'all', or as a character array beginning with custom= followed by a comma-separated list of variable names.

For more information, see Parameters (-variables-written-before-loop).

Example: opts.CodeProverVerification.VariablesWrittenBeforeLoop = 'all'

This property affects Code Prover analysis only.

Variables that the generated main must initialize in the cyclic code loop, specified as 'none', 'all', or as a character array beginning with custom= followed by a comma-separated list of variable names.

For more information, see Inputs (-variables-written-in-loop).

Example: opts.CodeProverVerification.VariablesWrittenInLoop = 'all'

CodingRulesCodeMetrics

expand all

Subset of MISRA AC AGC rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA AC AGC (-misra-ac-agc).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA AC AGC rules, also set EnableAcAgc to true.

Example: opts.CodingRulesCodeMetrics.AcAgcSubset = 'all-rules'

Data Types: char

Pragma directives for which MISRA C:2004 rule 3.4 or MISRA C++ 16-6-1 must not be applied, specified as a cell array of character vectors. This property affects only MISRA C:2004 or MISRA AC AGC rule checking.

For more information, see Allowed pragmas (-allowed-pragmas).

Example: opts.CodingRulesCodeMetrics.AllowedPragmas = {'pragma_01','pragma_02'}

Data Types: cell

This property affects Bug Finder only.

Set of AUTOSAR C++ 14 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check AUTOSAR C++ 14 security checks (-autosar-cpp14).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check AUTOSAR C++ 14 rules, also set EnableAutosarCpp14 to true.

Example: opts.CodingRulesCodeMetrics.AutosarCpp14 = 'all'

Data Types: char

Data types that the coding rule checker must treat as effectively Boolean, specified as a cell array of character vectors.

For more information, see Effective boolean types (-boolean-types).

Example: opts.CodingRulesCodeMetrics.BooleanTypes = {'boolean1_t','boolean2_t'}

Data Types: cell

This property affects Bug Finder only.

Set of CERT C rules and recommendations to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check CERT-C security checks (-cert-c).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use from-file for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check CERT C rules and recommendations, also set EnableCertC to true.

Example: opts.CodingRulesCodeMetrics.CertC = 'all'

Data Types: char

This property affects Bug Finder only.

Set of CERT C++ rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check CERT-C++ security checks (-cert-cpp).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check CERT C++ rules, also set EnableCertCpp to true.

Example: opts.CodingRulesCodeMetrics.CertCpp = 'all'

Data Types: char

File where you define a custom set of coding standards checkers to check, specified as a .xml file. You can, in the same file, define a custom set of checkers for each of the coding standards that Polyspace supports. To create a file that defines a custom selection of coding standard checkers, in the Polyspace interface, select a coding standard on the Coding Standards & Code Metrics node of the Configuration pane and click Edit.

For more information, see Set checkers by file (-checkers-selection-file).

Example: opts.CodingRulesCodeMetrics.CheckersSelectionByFile = 'C:\ps_settings\coding_rules\custom_rules.xml'

Data Types: char

Activate code metric calculations, specified as true or false. If this property is turned off, Polyspace does not calculate code metrics even if you upload your results to Polyspace Metrics.

For more information about the code metrics, see Calculate code metrics (-code-metrics).

If you assign a coding rules options object to this property, an XML file gets created automatically with the rules specified.

Example: opts.CodingRulesCodeMetrics.CodeMetrics = true

This property affects Bug Finder only.

Set of CWE rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check CWE (-cwe).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check CERT C++ rules, also set EnableCwe to true.

Example: opts.CodingRulesCodeMetrics.Cwe = 'cwe-658-659'

Data Types: char

Check MISRA AC AGC rules, specified as true or false. To customize which rules are checked, use AcAgcSubset.

For more information about the MISRA AC AGC checker, see Check MISRA AC AGC (-misra-ac-agc).

Example: opts.CodingRulesCodeMetrics.EnableAcAgc = true;

This property affects Bug Finder only.

Check AUTOSAR C++ 14 rules, specified as true or false. To customize which rules are checked, use AutosarCpp14.

For more information about the AUTOSAR C++ 14 checker, see Check AUTOSAR C++ 14 checks (-autosar-cpp14).

Example: opts.CodingRulesCodeMetrics.EnableAutosarCpp14 = true;

This property affects Bug Finder only.

Check CERT C rules and recommendations, specified as true or false. To customize which rules are checked, use CertC.

For more information about the CERT C checker, see Check SEI CERT-C checks (-cert-c).

Example: opts.CodingRulesCodeMetrics.EnableCertC = true;

This property affects Bug Finder only.

Check CERT C++ rules, specified as true or false. To customize which rules are checked, use CertCpp.

For more information about the CERT C++ checker, see Check SEI-CERT-C++ (-cert-cpp).

Example: opts.CodingRulesCodeMetrics.EnableCertCpp = true;

Check custom set of coding standard checkers, specified as true or false. If you set this property to true, specify the path of checkers selection XML file for the property CheckersSelectionByFile and set one of these properties to 'from-file' to enable the corresponding coding standard custom set:

  • opts.CodingRulesCodeMetrics.AcAgcSubset='from-file'

  • opts.CodingRulesCodeMetrics.AutosarCpp14='from-file'

  • opts.CodingRulesCodeMetrics.CertC='from-file'

  • opts.CodingRulesCodeMetrics.CertCpp='from-file'

  • opts.CodingRulesCodeMetrics.Cwe='from-file'

  • opts.CodingRulesCodeMetrics.Guidelines='from-file'

  • opts.CodingRulesCodeMetrics.Iso17961='from-file'

  • opts.CodingRulesCodeMetrics.JsfSubset='from-file'

  • opts.CodingRulesCodeMetrics.MisraC3Subset='from-file'

  • opts.CodingRulesCodeMetrics.MisraCSubset='from-file'

  • opts.CodingRulesCodeMetrics.MisraCppSubset='from-file'

For more information, see Check custom rules (-custom-rules).

Example: opts.CodingRulesCodeMetrics.EnableCheckersSelectionByFile = true;

Check custom coding rules, specified as true or false. The file you specify with CheckersSelectionByFile defines the custom coding rules.

Use with EnableCheckersSelectionByFile.

For more information, see Check custom rules (-custom-rules).

Example: opts.CodingRulesCodeMetrics.EnableCustomRules = true;

This property affects Bug Finder only.

Check CWE rules, specified as true or false. To customize which rules are checked, use Cwe.

For more information about the CWE checker, see Check CWE (-cwe).

Example: opts.CodingRulesCodeMetrics.Cwe = true;

This property affects Bug Finder only.

Specify whether to check for violations of Guidelines. To customize which rules are checked, use Guidelines.

For more information about the Guidelines checker, see Check guidelines (-guidelines).

Example: opts.CodingRulesCodeMetrics.EnableGuidelines = true;

This property affects Bug Finder only.

Check ISO®/IEC TS 17961 rules, specified as true or false. To customize which rules are checked, use Iso17961.

For more information about the ISO-17961 checker, see Check ISO-17961 security checks (-iso-17961).

Example: opts.CodingRulesCodeMetrics.EnableIso17961 = true;

Check JSF C++ rules, specified as true or false. To customize which rules are checked, use JsfSubset.

For more information, see Check JSF C++ rules (-jsf-coding-rules).

Example: opts.CodingRulesCodeMetrics.EnableJsf = true;

Check MISRA C:2004 rules, specified as true or false. To customize which rules are checked, use MisraCSubset.

For more information, see Check MISRA C:2004 (-misra2).

Example: opts.CodingRulesCodeMetrics.EnableMisraC = true;

Check MISRA C:2012 rules, specified as true or false. To customize which rules are checked, use MisraC3Subset.

For more information about the MISRA C:2012 checker, see Check MISRA C:2012 (-misra3).

Example: opts.CodingRulesCodeMetrics.EnableMisraC3 = true;

Check MISRA C:2023 rules, specified as true or false. To customize which rules are checked, use MisraC2023.

For more information about the MISRA C:2023 checker, see Check MISRA C:2023 (-misra-c-2023).

Example: opts.CodingRulesCodeMetrics.EnableMisraC2023 = true;

Check MISRA C++:2008 rules, specified as true or false. To customize which rules are checked, use MisraCppSubset.

For more information about the MISRA C++:2008 checker, see Check MISRA C++ rules (-misra-cpp).

Example: opts.CodingRulesCodeMetrics.EnableMisraCpp = true;

Check MISRA C++:2023 rules, specified as true or false. To customize which rules are checked, use MisraCppSubset.

For more information about the MISRA C++:2023 checker, see Check MISRA C++:2023 (-misra-cpp-2023).

Example: opts.CodingRulesCodeMetrics.EnableMisraC2023 = true;

This property affects Bug Finder only.

Sets of Guideline rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check guidelines (-guidelines).

  • An XML file specifying Guidelines checkers and their thresholds. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations.

Example: opts.CodingRulesCodeMetrics.Guidelines = 'his';

This property affects Bug Finder only.

Set of ISO/IEC TS 17961 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check ISO-17961 (-iso-17961).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check ISO/IEC TS 17961 rules, also set EnableIso17961 to true.

Example: opts.CodingRulesCodeMetrics.Iso17961 = 'all'

Data Types: char

Subset of JSF C++ rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check JSF C++ rules (-jsf-coding-rules).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check JSF C++ rules, set EnableJsf to true.

Example: opts.CodingRulesCodeMetrics.JsfSubset = 'all-rules'

Data Types: char

Use the MISRA C:2012 categories for automatically generated code, specified as true or false.

For more information, see Use generated code requirements (-misra3-agc-mode).

Example: opts.CodingRulesCodeMetrics.Misra3AgcMode = true;

Subset of MISRA C:2023 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA C:2023 (-misra-c-2023).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA C:2023 rules, also set EnableMisraC2023 to true.

Example: opts.CodingRulesCodeMetrics.MisraC2023Subset = 'all'

Data Types: char

Subset of MISRA C:2012 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA C:2012 (-misra3).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA C:2012 rules, also set EnableMisraC3 to true.

Example: opts.CodingRulesCodeMetrics.MisraC3Subset = 'all'

Data Types: char

Subset of MISRA C:2004 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA C:2004 (-misra2).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA C:2004 rules, also set EnableMisraC to true.

Example: opts.CodingRulesCodeMetrics.MisraCSubset = 'all-rules'

Data Types: char

Subset of MISRA C++:2008 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA C++ rules (-misra-cpp).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA C++ rules, set EnableMisraCpp to true.

Example: opts.CodingRulesCodeMetrics.MisraCppSubset = 'all-rules'

Data Types: char

Subset of MISRA C++:2023 rules to check, specified by:

  • Character vector of one of the subset names. For more information about the different subsets, see Check MISRA C++:2023 (-misra-cpp-2023).

  • A coding rules options object. To create a coding rules options object, see polyspace.CodingRulesOptions.

  • An XML file specifying coding standard checkers. Use 'from-file' for this property and then use the EnableCheckersSelectionByFile and CheckersSelectionByFile property to specify the full path to the file where you define a custom subset of checkers.

    You can create this file manually or in the Polyspace interface. See Check for and Review Coding Standard Violations. If you assign a coding rules options object to this property, an XML file is created automatically and assigned to the CheckersSelectionByFile property. The XML file enables rules extracted from the coding rules options object.

To check MISRA C++ rules, set EnableMisraCpp2023 to true.

Example: opts.CodingRulesCodeMetrics.MisraCpp2023 = 'all-rules'

Data Types: char

EnvironmentSettings

expand all

Consider that file paths are in MS-DOS style, specified as true or false.

For more information, see Code from DOS or Windows file system (-dos).

Example: opts.EnvironmentSettings.Dos = true;

Include folders needed for compilation, specified as a cell array of the include folder paths.

To specify all subfolders of a folder, use folder path followed by **, for instance, 'C:\includes\**'. The notation follows the syntax of the dir function. See also Specify Multiple Source Files.

For more information, see -I.

Example: opts.EnvironmentSettings.IncludeFolders = {'/includes','/com1/inc'};

Example: opts.EnvironmentSettings.IncludeFolders = {'C:\project1\common\includes'};

Data Types: cell

Files to be #include-ed by each C source file in the analysis, specified by a cell array of files.

For more information, see Include (-include).

Example: opts.EnvironmentSettings.Includes = {'/inc/inc_file.h','/inc/inc_math.h'}

Ignore linking errors inside extern blocks, specified as true or false.

For more information, see Ignore link errors (-no-extern-c).

Example: opts.EnvironmentSettings.NoExternC = false;

Command or script to run on source files after preprocessing, specified as a character vector of the command to run.

For more information, see Command/script to apply to preprocessed files (-post-preprocessing-command).

Example: Linux — opts.EnvironmentSettings.PostPreProcessingCommand = [pwd,'/replace_keyword.pl']

Example: Windows — opts.EnvironmentSettings.PostPreProcessingCommand = '"C:\Program Files\MATLAB\R2015b\sys\perl\win32\bin\perl.exe" "C:\My_Scripts\replace_keyword.pl"'

Specify the encoding of your source files. Specifying the source encoding allows Polyspace to correctly interpret non-ASCII characters.

For more information, see Source code encoding (-sources-encoding).

Example: opts.EnvironmentSettings.SourcesEncoding = 'utf-8';

Stop analysis if a file does not compile, specified as true or false.

For more information, see Stop analysis if a file does not compile (-stop-if-compile-error).

Example: opts.EnvironmentSettings.StopWithCompileError = true;

InputsStubbing

expand all

Constrain global variables, function inputs, and return values of stubbed functions specified by the path to an XML constraint file. For more information about the constraint file, see Specify External Constraints for Polyspace Analysis.

For more information about this option, see Constraint setup (-data-range-specifications).

Example: opts.InputsStubbing.DataRangeSpecifications = 'C:\project\constraint_file.xml'

Files on which you do not want analysis results, specified by 'include-folders', 'all-headers', or a character array beginning with custom= followed by a comma-separated list of file or folder names.

Use this option with InputsStubbing.GenerateResultsFor. For more information, see Do not generate results for (-do-not-generate-results-for).

Example: opts.InputsStubbing.DoNotGenerateResultsFor = 'custom=C:\project\file1.c,C:\project\file2.c'

Files on which you want analysis results, specified by 'source-headers', 'all-headers', or a character array beginning with custom= followed by a comma-separated list of file or folder names.

Use this option with InputsStubbing.DoNotGenerateResultsFor. For more information, see Generate results for sources and (-generate-results-for).

Example: opts.InputsStubbing.GenerateResultsFor = 'custom=C:\project\includes_common_1,C:\project\includes_common_2'

This property affects Code Prover analysis only.

Functions to stub during analysis, specified as a cell array of function names.

For more information, see Functions to stub (-functions-to-stub) (Polyspace Code Prover).

Example: opts.InputsStubbing.FunctionsToStub = {'func1', 'func2'}

This property affects Code Prover analysis only.

Consider global variables as uninitialized, specified as true or false.

For more information, see Ignore default initialization of global variables (-no-def-init-glob) (Polyspace Code Prover).

Example: opts.InputsStubbing.NoDefInitGlob = true

This property applies only to a Code Prover analysis of code generated from models.

Specify that the analysis must stub functions in the generated code that use lookup tables. By replacing the functions with stubs, the analysis assumes more precise return values for the functions.

For more information, see Generate stubs for Embedded Coder lookup tables (-stub-embedded-coder-lookup-table-functions) (Polyspace Code Prover).

Example: opts.InputsStubbing.StubECoderLookupTables = true

Macros

expand all

In preprocessed code, macros are replaced by the definition, specified in a cell array of macros and definitions. Specify the macro as Macro=Value. If you want Polyspace to ignore the macro, leave the Value blank. A macro with no equal sign replaces all instances of that macro by 1.

For more information, see Preprocessor definitions (-D).

Example: opts.Macros.DefinedMacros = {'uint32=int','name3=','var'}

In preprocessed code, macros are undefined, specified by a cell array of macros to undefine.

For more information, see Disabled preprocessor definitions (-U).

Example: opts.Macros.DefinedMacros = {'name1','name2'}

MergedComputingSettings

expand all

This property affects Bug Finder analysis only.

Send Bug Finder analysis to remote server, specified as true or false. To use this option, in your Polyspace preferences, you must specify a metrics server.

For more information, see:

Example: opts.MergedComputingSettings.BatchBugFinder = true;

This property affects Code Prover analysis only.

Send Code Prover analysis to remote server, specified as true or false. To use this option, in your Polyspace preferences, you must specify a metrics server.

For more information, see:

Example: opts.MergedComputingSettings.BatchCodeProver = true;

This property affects Bug Finder analysis only.

Use fast analysis mode for Bug Finder analysis, specified as true or false.

For more information, see Use fast analysis mode for Bug Finder (-fast-analysis).

Example: opts.MergedComputingSettings.FastAnalysis = true;

MergedReporting

expand all

After the analysis, generate a report, specified as true or false.

For more information, see Generate report.

Example: opts.MergedReporting.EnableReportGeneration = true

Output format of generated report, specified as one of the report formats. To activate this option, specify Reporting.EnableReportGeneration.

For more information about the different values, see Output format (-report-output-format).

Example: opts.MergedReporting.ReportOutputFormat = 'PDF'

This property affects a Bug Finder analysis only.

Template for generating analysis report, specified as one of the report formats. To activate this option, specify Reporting.EnableReportGeneration.

For more information about the different values, see Bug Finder and Code Prover report (-report-template).

Example: opts.MergedReporting.BugFinderReportTemplate = 'CodeMetrics'

This property affects a Code Prover analysis only.

Template for generating analysis report, specified as one of the predefined report formats. To activate this option, specify Reporting.EnableReportGeneration.

For more information about the different values, see Bug Finder and Code Prover report (-report-template) (Polyspace Code Prover).

Example: opts.MergedReporting.CodeProverReportTemplate = 'CodeMetrics'

Multitasking

expand all

Specify the path to the ARXML files the software parses to set up your multitasking configuration.

To activate this option, specify Multitasking.EnableExternalMultitasking and set Multitasking.ExternalMultitaskingType to autosar.

For more information, see ARXML files selection (-autosar-multitasking)

Example: opts.Multitasking.ArxmlMultitasking={'C:\Polyspace_Workspace\AUTOSAR\myFile.arxml'}

Functions that begin critical sections specified as a cell array of critical section function names. To activate this option, specify Multitasking.EnableMultitasking and Multitasking.CriticalSectionEnd.

For more information, see Critical section details (-critical-section-begin -critical-section-end).

Example: opts.Multitasking.CriticalSectionBegin = {'function1:cs1','function2:cs2'}

Functions that end critical sections specified as a cell array of critical section function names. To activate this option, specify Multitasking.EnableMultitasking and Multitasking.CriticalSectionBegin.

For more information, see Critical section details (-critical-section-begin -critical-section-end).

Example: opts.Multitasking.CriticalSectionEnd = {'function1:cs1','function2:cs2'}

Specify functions that represent cyclic tasks.

To activate this option, also specify Multitasking.EnableMultitasking.

For more information, see Cyclic tasks (-cyclic-tasks).

Example: opts.Multitasking.CyclicTasks = {'function1','function2'}

This property affects Code Prover analysis only.

Enable automatic detection of certain families of threading functions, specified as true or false.

For more information, see Enable automatic concurrency detection for Code Prover (-enable-concurrency-detection) (Polyspace Code Prover).

Example: opts.Multitasking.EnableConcurrencyDetection = true

Enable multitasking configuration of your projects from external files you provide. Configure multitasking from ARXML files for an AUTOSAR project, or from OIL files for an OSEK project.

Activate this option to enable Multitasking.ArxmlMultitasking or Multitasking.OsekMultitasking.

For more information, see OIL files selection (-osek-multitasking) and ARXML files selection (-autosar-multitasking).

Example: opts.Multitasking.EnableExternalMultitasking = 1

Configure multitasking manually by specifying true. This property activates the other manual, multitasking properties.

For more information, see Configure multitasking manually.

Example: opts.Multitasking.EnableMultitasking = 1

Functions that serve as entry-points to your multitasking application specified as a cell array of entry-point function names. To activate this option, also specify Multitasking.EnableMultitasking.

For more information, see Tasks (-entry-points).

Example: opts.Multitasking.EntryPoints = {'function1','function2'}

Specify the type of file the software parses to set up your multitasking configuration:

  • For osek type, the analysis looks for OIL files in the file or folder paths that you specify.

  • For autosar type, the analysis looks for ARXML files in the file paths that you specify.

To activate this option, specify Multitasking.EnableExternalMultitasking.

For more information, see OIL files selection (-osek-multitasking) and ARXML files selection (-autosar-multitasking).

Example: opts.Multitasking.ExternalMultitaskingType = 'autosar'

Specify functions that represent nonpreemptable interrupts.

To activate this option, specify Multitasking.EnableMultitasking.

For more information, see Interrupts (-interrupts).

Example: opts.Multitasking.Interrupts = {'function1','function2'}

This property affects Bug Finder analysis only.

Specify function that disables all interrupts.

To activate this option, specify Multitasking.EnableMultitasking.

For more information, see Disabling all interrupts (-routine-disable-interrupts -routine-enable-interrupts)Disabling all interrupts (-routine-disable-interrupts -routine-enable-interrupts).

Example: opts.Multitasking.InterruptsDisableAll = {'function'}

This property affects Bug Finder analysis only.

Specify function that reenables all interrupts.

To activate this option, specify Multitasking.EnableMultitasking.

For more information, see Disabling all interrupts (-routine-disable-interrupts -routine-enable-interrupts)Disabling all interrupts (-routine-disable-interrupts -routine-enable-interrupts).

Example: opts.Multitasking.InterruptsEnableAll = {'function'}

Specify the path to the OIL files the software parses to set up your multitasking configuration:

  • In the mode specified with 'auto', the analysis uses OIL files in your project source and include folders, but not their subfolders.

  • In the mode specified with 'custom=folder1[,folder2,...]', the analysis uses the OIL files at the specified path, and the path subfolders.

To activate this option, specify Multitasking.EnableExternalMultitasking and set Multitasking.ExternalMultitaskingType to osek.

For more information, see OIL files selection (-osek-multitasking)

Example: opts.Multitasking.OsekMultitasking = 'custom=file_path, dir_path'

Entry-point functions that cannot execute concurrently specified as a cell array of entry-point function names. Each set of exclusive tasks is one cell array entry with functions separated by spaces. To activate this option, specify Multitasking.EnableMultitasking.

For more information, see Temporally exclusive tasks (-temporal-exclusions-file).

Example: opts.Multitasking.TemporalExclusion = {'function1 function2', 'function3 function4 function5'} where function1 and function2 are temporally exclusive, and function3, function4, and function 5 are temporally exclusive.

Precision (Affects Code Prover Only)

expand all

This property affects Code Prover analysis only.

Store call context information to identify a function call that caused errors, specified as none, auto, or as a character array beginning with custom= followed by a list of comma-separated function names.

For more information, see Sensitivity context (-context-sensitivity) (Polyspace Code Prover).

Example: opts.Precision.ContextSensitivity = 'auto'

Example: opts.Precision.ContextSensitivity = 'custom=func1'

This property affects Code Prover analysis only.

Source files that you want to verify at higher precision, specified as a cell array of file names without the extension and precision levels using this syntax: filename:Olevel

For more information, see Specific precision (-modules-precision) (Polyspace Code Prover).

Example: opts.Precision.ModulesPrecision = {'file1:O0', 'file2:O3'}

This property affects Code Prover analysis only.

Precision level for the verification, specified as 0, 1, 2, or 3.

For more information, see Precision level (-O) (Polyspace Code Prover).

Example: opts.Precision.OLevel = 3

This property affects Code Prover analysis only.

Avoid certain verification approximations for code with fewer lines, specified as a positive integer representing how sensitive the analysis is. Higher values can increase verification time exponentially.

For more information, see Improve precision of interprocedural analysis (-path-sensitivity-delta) (Polyspace Code Prover).

Example: opts.Precision.PathSensitivityDelta = 2

This property affects Code Prover analysis only.

Time limit on your verification, specified as a character vector of time in hours.

For more information, see Verification time limit (-timeout) (Polyspace Code Prover).

Example: opts.Precision.Timeout = '5.75'

This property affects Code Prover analysis only.

Number of times the verification process runs, specified as one of the preset analysis levels.

For more information, see Verification level (-to) (Polyspace Code Prover).

Example: opts.Precision.To = 'Software Safety Analysis level 3'

Scaling (Affects Code Prover Only)

expand all

This property affects Code Prover analysis only.

Functions on which separate results must be generated for each function call, specified as a cell array of function names.

For more information, see Inline (-inline) (Polyspace Code Prover).

Example: opts.Scaling.Inline = {'func1','func2'}

This property affects Code Prover analysis only.

Limit depth of analysis for nested structures, specified as a positive integer indicating how many levels into a nested structure to verify.

For more information, see Depth of verification inside structures (-k-limiting) (Polyspace Code Prover).

Example: opts.Scaling.KLimiting = 3

TargetCompiler

expand all

Compiler that builds your source code.

For more information, see Compiler (-compiler).

Example: opts.TargetCompiler.Compiler = 'Visual11.0'

Specify C++ standard version followed in code, specified as a character vector.

For more information, see C++ standard version (-cpp-version).

Example: opts.TargetCompiler.CppVersion = 'cpp11';

Specify C standard version followed in code, specified as a character vector.

For more information, see C standard version (-c-version).

Example: opts.TargetCompiler.CVersion = 'c90';

Round down quotients from division or modulus of negative numbers, specified as true or false.

For more information, see Division round down (-div-round-down).

Example: opts.TargetCompiler.DivRoundDown = true

Base type representation of enum, specified by an allowed base-type set. For more information about the different values, see Enum type definition (-enum-type-definition).

Example: opts.TargetCompiler.EnumTypeDefinition = 'auto-unsigned-first'

Ignore #pragma pack directives, specified as true or false.

For more information, see Ignore pragma pack directives (-ignore-pragma-pack).

Example: opts.TargetCompiler.IgnorePragmaPack = true

This property is read-only.

Language of the analysis, specified during the object construction. This value changes which properties appear.

For more information, see Source code language (-lang).

Treatment of signed bit on signed variables, specified as Arithmetical or Logical. For more information, see Signed right shift (-logical-signed-right-shift).

Example: opts.TargetCompiler.LogicalSignedRightShift = 'Logical'

Do not use predefined typedefs for char16_t or char32_t, specified as true or false. For more information, see Block char16/32_t types (-no-uliterals).

Example: opts.TargetCompiler.NoUliterals = true

Default structure packing alignment, specified as 'defined-by-compiler', '1', '2', '4', '8', or '16'. This property is available only for Visual C++ code.

For more information, see Pack alignment value (-pack-alignment-value).

Example: opts.TargetCompiler.PackAlignmentValue = '4'

sfr types, specified as a cell array of sfr keywords using the syntax sfr_name=size_in_bits. For more information, see Sfr type support (-sfr-types).

This option only applies when you set TargetCompiler.Compiler to keil or iar.

Example: opts.TargetCompiler.SfrTypes = {'sfr32=32'}

Underlying type of size_t, specified as 'defined-by-compiler', 'unsigned-int', 'unsigned-long', or 'unsigned-long-long'. See Management of size_t (-size-t-type-is).

Example: opts.TargetCompiler.SizeTTypeIs = 'unsigned-long'

Set size of data types and endianness of processor, specified as one of the predefined target processors or a generic target object.

For more information about the predefined processors, see Target processor type (-target).

For more information about creating a generic target, see polyspace.GenericTargetOptions.

Example: opts.TargetCompiler.Target = 'hc12'

Underlying type of wchar_t, specified as 'defined-by-compiler', 'signed-short', 'unsigned-short', 'signed-int', 'unsigned-int', 'signed-long', or 'unsigned-long'. See Management of wchar_t (-wchar-t-type-is).

Example: opts.TargetCompiler.WcharTTypeIs = 'unsigned-int'

VerificationAssumption (Affects Code Prover Only)

expand all

This property affects Code Prover analysis only.

Assume that volatile qualified structure fields can have all possible values at any point in code.

For more information, see Consider volatile qualifier on fields (-consider-volatile-qualifier-on-fields) (Polyspace Code Prover).

Example: opts.VerificationAssumption.ConsiderVolatileQualifierOnFields = true

This property affects Code Prover analysis only.

Specify that environment pointers can be NULL unless constrained otherwise.

For more information, see Consider environment pointers as unsafe (-stubbed-pointers-are-unsafe) (Polyspace Code Prover).

Example: opts.VerificationAssumption.ConstraintPointersMayBeNull = true

This property affects Code Prover analysis only.

Rounding modes to consider when determining the results of floating-point arithmetic, specified as to-nearest or all.

For more information, see Float rounding mode (-float-rounding-mode) (Polyspace Code Prover).

Example: opts.VerificationAssumption.FloatRoundingMode = 'all'

Other Properties

expand all

Name of project author, specified as a character vector.

For more information, see -author.

Example: opts.Author = 'JaneDoe'

To import comments and justifications from a previous analysis, specify the path to the results folder of the previous analysis.

You can also point to a previous results folder to see only new results compared to the previous run. See Compare Results from Different Polyspace Runs by Using MATLAB Scripts.

For more information, see -import-comments

Example: opts.ImportComments = fullfile(polyspaceroot,'polyspace','examples','cxx','Bug_Finder_Example','Module_1','BF_Result')

Project name, specified as a character vector.

For more information, see -prog.

Example: opts.Prog = 'myProject'

Location to store results, specified as a folder path. By default, the results are stored in the current folder.

For more information, see -results-dir.

You can also create a separate results folder for each new run. See Compare Results from Different Polyspace Runs by Using MATLAB Scripts.

Example: opts.ResultsDir = 'C:\project\myproject\results\'

Source files to analyze, specified as a cell array of files.

To specify all files in a folder, use folder path followed by *, for instance, 'C:\src\*'. To specify all files in a folder and its subfolders, use folder path followed by **, for instance, 'C:\src\**'. The notation follows the syntax of the dir function. See also Specify Multiple Source Files.

For more information, see -sources.

Example: opts.Sources = {'file1.c', 'file2.c', 'file3.c'}

Example: opts.Sources = {'project/src1/file1.c', 'project/src2/file2.c', 'project/src3/file3.c'}

Version number of project, specified as a character array of a number. This option is useful if you upload your results to Polyspace Metrics. If you increment version numbers each time that you reanalyze your object, you can compare the results from two versions in Polyspace Metrics.

For more information, see -v[ersion].

Example: opts.Version = '2.3'

Version History

Introduced in R2017a