-
-
Notifications
You must be signed in to change notification settings - Fork 114
Missing prototype in Arduino 1.6.8 #140
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
Comments
The bug is caused by the function of the same name in the library: https://github.com/felis/USB_Host_Shield_2.0/blob/master/Wii.h#L430.
With Arduino IDE 1.6.8 and 1.6.9 2016/04/28 04:33 this fails to compile. With Arduino IDE 1.6.7 and previous it successfully compiles. |
I suspect #131 would "fix" the original bug (not the testcase @per1234 provided), by not running ctags on the library code, just on the sketch code. However, looking at the ctags output, this is what is generated for the asdf sketch_may03a.ino /^ void asdf() {}$/;" kind:function line:4 class:test signature:() returntype:void The class:test indicates that this is a method, not a function, but I suspect arduino-builder ignores that, so that should be fixed. @per1234, thanks for looking into this and pointing out the cause! @facchinm, would you look into fixing this? |
Signed-off-by: Martino Facchin <[email protected]>
While generating prototypes, a scan is made for any function definitions which would result in identical prototypes, and all but the first are skipped. However, when doing so, this did not take into account function definitions which were already marked to be skipped, which could cause *all* definitions to be skipped. This behaviour caused a particular problem when a method definition existed with the same signature as a function definition. All method definitions are skipped through `tagIsUnhandled`, but could still make `skipDuplicates` skip the corresponding function definition. This commit fixes this. It is not entirely clear to me if this duplicate removal is actually needed at all. If code contains multiple function definitions with the same signature, you would expect the compiler to throw an error anyway. If duplicate removal would be removed, only one testcase (TestCTagsToPrototypesShouldDealFunctionWithDifferentSignatures) fails, but that testcase uses a predefined ctags output that contains a duplicate function definition. It is not quite clear what source files this output was generated from (it seems to stem from CharWithEscapedDoubleQuote.ino, which originated at arduino/Arduino#1245, but those only contain one version of the function definition, not two). Still, since the ctags parsing will hopefully be replaced in the near future, this just fixes the duplicate removal instead of removing it and risking a regression on some corner case. This fixes arduino#140. Signed-off-by: Martino Facchin <[email protected]> Signed-off-by: Matthijs Kooijman <[email protected]>
@matthijskooijman thanks and @per1234 thanks a lot for tracking down the cause of the bug! |
arduino 1.8.7 has same issue |
arduino 1.8.13 has same issue |
It seems like Arduino 1.6.8 does not generate the function prototypes for the following examples in the USB Host shield library correctly: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/WiiMulti/WiiMulti.ino and https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/Bluetooth/PS3Multi/PS3Multi.ino.
More specifically the function prototype
void onInit();
does not seem to be properly generated.This was originally reported by a user at the following issue: felis/USB_Host_Shield_2.0#237.
A workaround for now is just to create the function prototype manually:
The same examples work fine in Arduino 1.6.7.
The full debug output is available here: https://gist.github.com/Lauszus/3daf5e6a5a6dde47b849b72f498dbdc9.
The text was updated successfully, but these errors were encountered: