-
-
Notifications
You must be signed in to change notification settings - Fork 414
Description
Describe the problem
This came to my attention from a contributor in this PR who was trying to fix compile errors for a RP2040 platform. I found that the compiler was ignoring differences in the return types (bool vs void) when assigning the function pointer to a variable, I did some more poking and found that it would also ignore differences in argument types both within the library code and in end user code. I also tried finding another library that I could replicate the issue using one of their examples and was able to change the return type, the function didn't have arguments to try changing but it did give an error if I added an argument
To reproduce
Example 1
- Setup the example code here
- Change the return type of the
saveParamCallback
method (bool/long long/etc) - Compile the project
Example 2
- Setup the example code here
- Define an empty function
void foo(void *blk_id, size_t idSize, byte *data, size_t dataSize) {}
- Add
xmodem.setBlockLookupHandler(foo)
to thesetup
function - Change the return types and argument types of the
foo
function - Compile the project
Expected behavior
The compiler should return an error about incompatible function pointer types
Arduino CLI version
arduino-cli Version: nightly-20230605 Commit: f3ee0a8 Date: 2023-06-05T01:36:01Z
Operating system
Linux
Operating system version
Arch Linux
Additional context
No response
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the nightly build
- My report contains all necessary details