Why is hisf_0015: Check Stateflow charts for strong data typing failing when a function in the expression is defined in custom code?

6 views (last 30 days)
I have a MIN function defined as a macro in a C header that is being used in a Stateflow chart.
/* header */
#define MIN(A,B) ((A) > (B) ? (B) : (A))
%%Stateflow
[MIN(a,b) - single(2) == single(4)]
where a and b are singles. This expression is being flagged by hisf_0015, even though everything is a single.
Why is the check flagging this expression?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Aug 2020
Edited: MathWorks Support Team on 10 Aug 2020
This is a limitation of hisf_0015 because the 'MIN' macro is defined in a custom source file. The recommended workaround is to explicitly cast 'MIN' to a single data type.
The same limitation seems to apply for MAB check mathworks.jmaab.jc_0802.
  1 Comment
galaxy
galaxy on 4 Sep 2020
Edited: galaxy on 4 Sep 2020
@MathWorks Support Team
What about enum type check in jmaab.jc_0802?
I defined enum Pos_Enum as:
In stateflow chart, I set DrvPos = Pos_Enum.HIGH; with DrvPos data type is also Pos_Enum.
So why still warning in jmaab.jc_0802?

Sign in to comment.

More Answers (0)

Categories

Find more on Stateflow in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!