MISRA violation 10.1 - From stateflow transition if statement generated without explicit comparison

MISRA violation 10.1. From a state transition in stateflow the generetd code results as follow:
if ( bolean_variables)
{ ...
}
else
{...
}
instead
if(TRUE = bolean_variables)
{..
...

回答 (1 件)

Angelo Yeo
Angelo Yeo 2023 年 7 月 26 日
Can you elaborate what your pain point is? Why do you want to follow MISRA Rule 10.1 when your C code is auto-generated?
As you can see in MISRA C:2012 (I am asssuming you are trying to follow MISRA C 2012), Rule 10.1 becomes advisory (not "required" anymore) when it comes to an auto-generated C code.

2 件のコメント

Francesco
Francesco 2023 年 7 月 26 日
編集済み: Francesco 2023 年 7 月 26 日
Yes, you'll right about the MISRA rule but I would like to avoid to write an argumentation for all of these advisory. There are a lot of advisory releted to rule 10.1 ... I was expected to fix it in the model, maybe acting on the code generation settings. If it is possible...
It's great that you work hard to get rid of all the violations. But in my humble opinion, it's not going to be worked out perfectly as this is an "advisory" rule for auto-generated codes.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

質問済み:

2023 年 7 月 25 日

コメント済み:

2023 年 7 月 26 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by