-
Notifications
You must be signed in to change notification settings - Fork 2k
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
dist/tools/cppcheck: improve warnings #17300
base: master
Are you sure you want to change the base?
Conversation
- provide include paths and defines of samr21-xpro - provide platform configuration for Cortex-M MCUs - detect include paths of all modules by searching for include folders in core, drivers, and sys - filter out files in cpu/* and boards/* before checking, as those depend on board/architecture specific include paths and defines
@@ -248,9 +248,6 @@ static int _receive(gnrc_pktsnip_t *pkt) | |||
mutex_unlock(&list->lock); | |||
|
|||
/* Call FSM with event RCVD_PKT if a fitting TCB was found */ | |||
/* cppcheck-suppress knownConditionTrueFalse | |||
* (reason: tcb can be NULL at runtime) | |||
*/ | |||
if (tcb != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the warning of cppcheck
is correct: tcb
must be NULL
, since the while (tcb)
has no break
in it except when MODULE_GNRC_IPV6
is defined (which cppcheck
assumes to not be the case).
@brummer-simon @miri64: What was the reasoning behind this: RIOT/sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c Lines 239 to 245 in 44ebc38
Isn't this one of the "we know your configuration is broken at build time, but we still emit a firmware that you can spent on hours debugging" cases that @benpicco is such a huge fan of? Why not add #ifndef MODULE_GNRC_IPV6
#error "module gnrc_ipv6 required but not used"
#endif for ease of mind and model the dependency so that this cannot happen? |
Good question regarding the reasoning. In general I am favor of breaking things at build time. |
Is this waiting for anything? |
d597046
to
2979dc5
Compare
I dropped the last commit disabling some of the cppcheck suppression, which were mostly still needed. I don't have locally the old version of cppcheck used in the CI installed, so it is some effort for me to remove only unneeded suppressions. That should be easier once the CI is updated. |
Ugh if this brings back the need to litter the code with cppcheck suppression comments just to get it though CI, we should wait with merging it until CI has been updated. |
+1 |
Is CI sufficiently up to date now that we can give this another try? |
good question. Maybe @kaspar030 knows? |
Maybe it would also make sense to just build it from source. Having top notch static analysis is helpful. Speaking of that, both LLVM and GCC have static analysis tools that at least from the outside look more promising than cppcheck. That isn't supposed to be an argument against also using cppcheck in addition. Once the false positive rate gets acceptable, any additional tool that increase coverage will help. |
Contribution description
core
,drivers
, andsys
cpu/*
andboards/*
before checking, as those depend on board/architecture specific include paths and definessys/net/grnc
that should no longer pop up with the proper type definitions now aroundTesting procedure
At least some of the dropped suppressions should no longer be needed. (Note: None of these is needed with the latest
cppcheck
, but other warnings are generated instead.)Issues/PRs references
#17282