How to annotating Code Block?

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

Réponses (1)

Anirban
Anirban le 1 Fév 2022
Modifié(e) : Anirban le 2 Fév 2022

0 votes

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 commentaires

Mina Ebraheem
Mina Ebraheem le 2 Fév 2022
Hello Anirban,
Thank you for your helping.
I am trying this option but I couldn't change the number.
I copied the file "code-behavior-specifications-template.xml" and renamed it to "code-behavior-specifications.xml" and put this file at the project where I run the polyspace.
please find the attached file." please change the extention from .txt to .xml "
after that I added the command line at the .bat file which is needed to run the polyspace
this is the comand line
-code-behavior-specifications ".\code-behavior-specifications.xml"
Thanks in advance,
Mina Ebraheem
Anirban
Anirban le 2 Fév 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 le 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

Connectez-vous pour commenter.

Tags

Commenté :

le 31 Jan 2024

Community Treasure Hunt

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

Start Hunting!

Translated by