I know there is an inline rule suppression feature and it works for me fine, but how do I inline re-enable the suppressed rule after I no longer need it to be suppressed?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know there is an inline rule suppression feature and it works for me fine, but how do I inline re-enable the suppressed rule after I no longer need it to be suppressed?
I am not sure what you mean. Just remove the comment?
I meant that I want only a specific portion of a file with suppression and the rest of the file should be checked for MISRA compatibility.
// inline suppress
some_code_that_should_not_be_checked();
// inline un-suppress
some_code_that_should_be_checked();
We do not have such functionality at the moment. Sounds weird that you have different coding rules in a file. How about using a define?
cppcheck -DCPPCHECK_MISRA_CHECKER --addon=misra file.c
well it's a simple solution but maybe that will have problems I don't know.
If you had different files for misra compliant code and non-misra-compliant code then you could suppress:
--suppress="misra-c2012-*:non-compliant-file.h"