How to annotating Code Block?

6 visualizzazioni (ultimi 30 giorni)
Mina Ebraheem
Mina Ebraheem il 1 Feb 2022
Commentato: Christian il 31 Gen 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

Risposte (1)

Anirban
Anirban il 1 Feb 2022
Modificato: Anirban il 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 Commenti
Anirban
Anirban il 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 il 31 Gen 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

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by