-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M0-1-10
: Generates lot of false positives for used functions
#711
Comments
Proposed Fix(es)Hi @lcartey, kindly let me know your valuable insights whether the following can be acceptable or not. The MISRA2008 standard doesn't highlight any specific exception for this rule. However, considering CodeQL's limitation and to make it more practical to check the results of this query, can we propose to restrict this query in the following way? I would like to seek opinions about the same.
|
Hi Rakesh. Thanks again for reporting this. To take each suggestion in turn:
Yes, I think that would be reasonable.
Functions from template instantiations should already be excluded (but contribute to whether the uninstantiated version of the function is considered used or not). Do you have a specific example where they are not?
I think we can exclude special member functions which are marked I note that the equivalent rule in MISRA C++ 2023 (Rule 0.2.4) does exclude special member functions, so another option would be to split the rule into two queries (one for special member functions, one without) so as to enable deviations to be applied to this case.
Yes, the query already has a concept of an |
Thanks a lot @lcartey for your valuable inputs! I will incorporate suggestions (1), (4) and (5) above. Any thoughts on finding out the call to the |
Fix false positives of M0-1-10 (#711)
Closing as completed by #725. |
Affected rules
Description
The query M0-1-10 generates a significant amount of false positives while analyzing "unused functions". These are noticed especially in the following scenarios.
This results from the fact that CodeQL cannot track the usages of such functions in compile time constructs like constexpr, static_asserts, templates etc.
Example
test.hpp
test.cpp
The text was updated successfully, but these errors were encountered: