-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiler warnings checks and fixes #316
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
Conversation
…ix sign-compare warnings
valid_params_if(PWM, mode == PWM_DIV_FREE_RUNNING || | ||
mode == PWM_DIV_B_RISING || | ||
mode == PWM_DIV_B_HIGH || | ||
mode == PWM_DIV_B_FALLING); |
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.
a) it probably makes sense to list these in the same order they're listed in the enum? (i.e. swap round PWM_DIV_B_RISING
and PWM_DIV_B_HIGH
)
b) as this is a multi-line chunk of code repeated in both pwm_config_set_clkdiv_mode
and pwm_set_clkdiv_mode
it's probably worth factoring it out to an(other) inline function?
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.
a) don't care enough to change it.
b) thought about it at the time, but decided against because it is non functional code... and i was just working around a compiler limitation
|
||
target_compile_definitions(kitchen_sink_libs INTERFACE | ||
NDEBUG | ||
PARAM_ASSERTIONS_ENABLE_ALL=1 # want to check all the assertions for compilation warnings |
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.
Haha, I'd never noticed that this file is manually specifying NDEBUG
! That explains why I couldn't get the compiler to throw errors at me when I deliberately put syntax-errors inside valid_params_if
/ invalid_params_if
macros 🤣 (even when I was building in Debug mode and had enabled PARAM_ASSERTIONS_ENABLE_ALL
)
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.
yup; i have no idea why that was like that :-)
#include <stdio.h> | ||
#include "pico/stdlib.h" | ||
#include "pico/time.h" | ||
// Include all headers to check for compiler warnings |
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.
Is it worth having a build-time script do this automatically, as it's likely that additional headers will get added to the SDK in future?
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.
Partially added in #319 🙂
BTW I'm fairly sure I've mentioned it before, but when I build with
Is that something it'd be possible to squeeze a fix for into 1.1.2 ? |
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.
Approving, in case Graham wants to merge it as-is without addressing my comments.
nothing much i can do about that - it only happens on older gcc ( I think <8, <=8?)) |
Fair enough.
I just checked, and with gcc 10.2.1 it actually complains (with a similar error) about more parts 😉
|
Make kitchen_sink check param assertions, and include all headers - fix sign-compare warnings