19-02-2009, 10:09 AM
I have seen something similar in my travels through time and space but this time using a #pragma directive to silence the checker e.g. when the constants in a table are being initialised in the following way:
Rather than changing these to 0U, 1U etc. to comply with Rule 10.6 the programmer had added a #pragma to turn off the tool's warning messages. At least they had added a comment in the code to this effect and I suppose they may have argued that they would document this as per Rule 3.4. However I think this supports JonM's assertion that MISRA C could add some guidance on these "defeat" mechanisms in checkers.
Code:
const uint8_t cTable[TABLE_SIZE] = {0, 1, 2, 3 ... };
Embedded systems development for over 850 years