You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building with target_compile_options(proj_name PRIVATE -Wpedantic), there are a bunch of extra warnings in the sdk. I fixed the ones I saw for the rp2040 here: maqifrnswa@7253859
I wanted to check to see if there's an interest in cleaning these up. If so, I can work through the rp2350 as well and prepare a better commit.
Summary:
Most of them are for casting function pointers to/from object pointers (/.pico-sdk/sdk/2.1.0/src/rp2_common/hardware_flash/flash.c:120:65: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]).
I went through and changed functions that returned function pointers from: void *function_name(args); // which is a function that returns a pointer to data
to void (* function_name(args))(void); // a func. that returns a function pointer
Some functions return a data pointer or a func pointer, so I changed them from: void *function_name(args);
to uintptr_t function_name(args); // this allows casting to either a func or data pointer
To be super-super-super pedantic, things should be specific about whether they are returning a function pointer or data pointer. uintptr_t isn't ideal for function pointers, but I think (IMO) it's fine to use uintptr_t with these architectures since it is often used for cases like this where you have a ROM address that may be a function or data.
a couple stray ; from ISO C does not allow extra ';' outside of a function [-Wpedantic]
converted binary constants to hex binary constants are a C2X feature or GCC extension
The text was updated successfully, but these errors were encountered:
Building with
target_compile_options(proj_name PRIVATE -Wpedantic)
, there are a bunch of extra warnings in the sdk. I fixed the ones I saw for the rp2040 here:maqifrnswa@7253859
I wanted to check to see if there's an interest in cleaning these up. If so, I can work through the rp2350 as well and prepare a better commit.
Summary:
Most of them are for casting function pointers to/from object pointers (
/.pico-sdk/sdk/2.1.0/src/rp2_common/hardware_flash/flash.c:120:65: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
).I went through and changed functions that returned function pointers from:
void *function_name(args); // which is a function that returns a pointer to data
to
void (* function_name(args))(void); // a func. that returns a function pointer
Some functions return a data pointer or a func pointer, so I changed them from:
void *function_name(args);
to
uintptr_t function_name(args); // this allows casting to either a func or data pointer
To be super-super-super pedantic, things should be specific about whether they are returning a function pointer or data pointer.
uintptr_t
isn't ideal for function pointers, but I think (IMO) it's fine to useuintptr_t
with these architectures since it is often used for cases like this where you have a ROM address that may be a function or data.a couple stray
;
fromISO C does not allow extra ';' outside of a function [-Wpedantic]
converted binary constants to hex
binary constants are a C2X feature or GCC extension
The text was updated successfully, but these errors were encountered: