How to annotating Code Block?

2 次查看(过去 30 天)
Mina Ebraheem
Mina Ebraheem 2022-2-1
评论: Christian 2024-1-31
My problem is: I need to supress the MISRA rule1.1 and this rule is file scope then I have to put the comments at the begin and end of the file but this file is generated by davinci configuration then every time I generate the file those lines of code deleted.
/*polyspace-begin MISRA2012:1.1 [Justified:Low] "Macros included from RTE"*/
/*polyspace-end MISRA2012:1.1 [Justified:Low] "Macros included from RTE"*/
So I have to put then in below section. but this way doesn't work will.
/**********************************************************************************************************************
* DO NOT CHANGE THIS COMMENT! << Start of version logging area >> DO NOT CHANGE THIS COMMENT!
*********************************************************************************************************************/
/* PRQA S 0777, 0779 EOF */ /* MD_MSR_Rule5.1, MD_MSR_Rule5.2 */
/**********************************************************************************************************************
* DO NOT CHANGE THIS COMMENT! << End of version logging area >> DO NOT CHANGE THIS COMMENT!
*********************************************************************************************************************/
Do you have any idea regarding this issue?
thanks in advance
Mina Ebraheem

回答(1 个)

Anirban
Anirban 2022-2-1
编辑:Anirban 2022-2-2
MISRA Rule 1.1 flags the number of macros in a translation unit if this number exceeds the limit specified in the Standard. The reason is that exceeding the limit in the standard can lead to undefined behavior. In practice, compilers can have their own higher limit and a well-defined behavior below that limit, which is probably why you are justifying the result in the first place.
Starting R2021a, you can change the limit used in detection of rule 1.1 using the option -code-behavior-specifications. In the XML file used with this option, use this section to specify your compiler limit.
<global_scope>
<parameter name="MAX_NUMBER_MACROS_TRANSLATION_UNIT" value="n"/>
</global_scope>
This way, you will not see this particular violation.
  3 个评论
Anirban
Anirban 2022-2-2
If you remove the ellipsis (...) before and after <parameter>, it should work. Sorry, I used the ellipsis to just indicate other elements you can use. I removed them now.
Christian
Christian 2024-1-31
Hello,
is it possible to insert in the Polyspace, via GUI options, directly
MAX_NUMBER_MACROS_TRANSLATION_UNIT = 8000
or is it need to run polyspace via command line and pass it
code-behavior-specifications.xml as paramenter?
-code-behavior-specifications ".\code-behavior-specifications.xml"
Thank you, best regards
Christian

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Generate Report 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by