Suppress generation of default cases for Stateflow switch statements if unreachable
Whether to generate default cases for switch-case statements for Stateflow charts
Model Configuration Pane: Code Generation / Code Style
Description
Specify whether to generate default cases for switch-case statements in the code for Stateflow® charts. This optimization works on a per-model basis. It applies to the code generated for a state that has multiple substates. For a list of the state functions in the generated code, see Inline State Functions in Generated Code.
Settings
on
(default) | off
Default: on
- On
Do not generate the default case when it is unreachable. This setting enables better code coverage because every branch in the generated code is falsifiable.
- Off
Generate a default case whether or not it is reachable. This setting supports MISRA C™ compliance and provides a backup in case of RAM corruption.
Examples
Recommended Settings
Application | Setting |
---|---|
Debugging | Noimpact |
Traceability | On |
Efficiency | On (execution, ROM), No impact (RAM) |
Safety precaution | No recommendation |
Programmatic Use
Parameter: SuppressUnreachableDefaultCases |
Type: character vector |
Value: 'on' | 'off' |
Default: 'on' |
Version History
Introduced in R2011b