开发者

Parasoft rulewizard

开发者 https://www.devze.com 2023-03-06 08:29 出处:网络
I\'m trying to create a static rule to check the token passing for defensive programming in a SIL4 application.

I'm trying to create a static rule to check the token passing for defensive programming in a SIL4 application.

The rule is the following: "Each functions shall have a const uint_32 as last parameter"

ie:

uint_32 foo(uint_32 a, uint_32 b, const uint_32 c)   ok 
uint_32 foo(uint_32 a, uint_32 b, const uint_16 c)  NOK
uint_32 foo(uint_32 a, uint_32 b, uint_32 c)  NOK
uint_32 foo(uint_32 a, const uint_32 b, uint_32 c)  NOK 

There's someone that may help me? I'm groping in the d开发者_Python百科ark


You can first collect numbers of all parameters (using ParamNumber property) in a collector. Then select parameter with ParamNumber equal to the highest collected number (you can use MAX() to get that). Then you can check if this parameter has appropriate type.

Irek

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号