How to annotating Code Block?

6 views (last 30 days)
Mina Ebraheem
Mina Ebraheem on 1 Feb 2022
Commented: Christian on 31 Jan 2024
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

Answers (1)

Anirban
Anirban on 1 Feb 2022
Edited: Anirban on 2 Feb 2022
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 Comments
Anirban
Anirban on 2 Feb 2022
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 on 31 Jan 2024
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

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!