How to annotating Code Block?

조회 수: 5 (최근 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

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by