Main Content

Check safety-related code generation settings for code style

mathworks.hism.hisl_0047

Dependencies: Simulink® Check™

Usage: High-Integrity System Modeling

Guideline: hisl_0047: Configuration Parameters > Code Generation > Code Style

Description

This check verifies that model configuration parameters for code style are set optimally for a safety-related application.

Recommended Actions and Results

Review the violations that are flagged by the check and the recommended action for fixing the issue. After applying the changes, save the model and rerun the check analysis.

If you consider the flagged violation to either not be relevant or not feasible for your design, use the Justify button to provide rationale as to why the violation is either not relevant or not feasible for your design.

You can use the Fix button to allow the Model Advisor to fix all flagged violations. For this check, the Model Advisor configures model code generation settings that can impact safety.

Modeling ConditionRecommended Action
The parenthesization style for generated code is set to Minimum (Rely on C/C++ operators precedence) or to Nominal (Optimize for readability). For safety-related applications, explicitly specify precedence with parentheses. Set model configuration parameter Parentheses level (Embedded Coder) to Standards(Parentheses for Standards Compliance) or Maximum(Specify precedence with parentheses), or set the parameter ParenthesesLevel to 'Standards' or 'Maximum'.
Code generation is not configured to preserve operand order. This option increases the traceability of the generated code.Select model configuration parameter Preserve operand order in expression (Embedded Coder) or set the parameter PreserveExpressionOrder to 'on'.

Capabilities and Limitations

  • Does not require model compilation

  • Does not run on library models

  • Does not allow exclusions of blocks or charts

  • Does not highlight parameter names in Model Advisor report without Embedded Coder®

Version History

Introduced in R2020a