Reconciling Polyspace Unused Parameter and MISRA 2.2 No Dead Code Warning
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I followed the advice of Polyspace help for avoiding unused parameter warnings, i.e. void cast the parameter:
void func( char x )
{
(void)x;
/* This function doesn't use x. */
}
But this in itself creates a MISRA violation 2.2: "There shall be no dead code." for the void cast.
Short of justification, is there a way to silence both MISRA 2.2 AND Polyspace Unsed Parameter warning for those few functions over which I have no control over the prototype?
Thank you.
0 Kommentare
Antworten (2)
Alexandre De Barros
am 14 Apr. 2017
Hi,
what about using a code annotation to automatically justify the defect? In this case, the annotation is:
/* polyspace<DEFECT:UNUSED_PARAMETER:Not a defect:No action planned> */
void func( char x )
The next time the analysis is launched, the defect will still be there but will have the severity "not a defect" (and the status "not action planned"). You can even use filters in the Results List to hide it from this view.
Alex
Siehe auch
Kategorien
Mehr zu Bug Finder Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!