Is it possible that this happens because the path of the folder including my_file.h has not been added to cppcheck include paths?
And so the addon doesn't find the file and this produces this behavior?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the normal cppcheck analysis I normally don't want that missing declarations leads to false positives. I consider it the recommended and usual case that users do not provide all the include paths for all headers.
In misra checking we have a bit more strict checking because it's used in safety. I think that:
* false positives are not "wanted" but it's better than false negatives. I consider a false positive to be "safe" as it will give you a hint you need to solve something.
* false negatives are not safe. If a misra checker does not know if there is a problem or not because of missing configuration, my intention is that a "misra-config" message will be written.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I enabled Misra C 2012 extension through the GUI of CppCheck 2.12.
I cannot use CppCheck 2.13 for this issue
This is my code:
my_file.h
my_file.c
But I ge the violation of misra rule 8.4.
I think this should be a Misra 2012 rule 8.4 (not Misra 2004), but here I can see Misra 2012 rules
https://www.ibm.com/docs/en/devops-test-embedded/8.2.0?topic=review-code-misra-2012-rules
And it should be
But as far as I understand, the prototype is in the .h file.
So I cannot understand the reason.
Another tool, that supports Misra 2004 only, notifies me about violation of rule 8.1
Are these false positve?
Or is there a way to fix this?
Is it possible that this happens because the path of the folder including my_file.h has not been added to cppcheck include paths?
And so the addon doesn't find the file and this produces this behavior?
yes if you didn't add the include path for my_file.h explicitly then it is very likely.
Last edit: Daniel Marjamäki 2024-01-31
In the normal cppcheck analysis I normally don't want that missing declarations leads to false positives. I consider it the recommended and usual case that users do not provide all the include paths for all headers.
In misra checking we have a bit more strict checking because it's used in safety. I think that:
* false positives are not "wanted" but it's better than false negatives. I consider a false positive to be "safe" as it will give you a hint you need to solve something.
* false negatives are not safe. If a misra checker does not know if there is a problem or not because of missing configuration, my intention is that a "misra-config" message will be written.