-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Function declaration isn't a prototype [-Wstrict-prototypes] #6933
Comments
It's a warning, and the parameter lists for the functions are all empty, so I really doubt it has any effect on the actual generated code. IMHO the linked PIO issue is something completely different. Have you done any tests with Arduino builds adding |
I can guarantee it's not an issue with the Arduino core. For G++, In the Arduino core, we have vanishingly few
|
Well I set the warning as a C-only warning, so the reported warnings are whenever the compiler is acting as a C-compiler and processing the code. Lately the WiFi issues with different stability per build do occur less often, so the move to C++ code probably also has a positive effect. In the esp8266/Arduino code base I use there are only 3 occurrences of these warnings. |
Fair enough. But I can pretty much guarantee that the warning about not having |
Well, I've already spent a lot of time on the build issues, and @Jason2866 is convinced it is related, so I am ready to try anything. Will provide a PR maybe tomorrow, but I am in the middle of moving to a new place so it is all a bit chaotic right now. |
For what it's worth, we did a -Wstrict-prototypes cleanup in the ESP32 SDK (after v4.0-dev). As a result, we did find a place or two where the function declared with an empty argument list was called with a non-zero amount of arguments. However nothing major and certainly no effect on the functionality. |
@igrr Was any of those few occurrences related to WiFi/network code? |
@TD-er @Jason2866 what @earlephilhower and @igrr explained is correct. Code stability doesn't depend on changing something like a function prototype, or in general adding/removing code. Trying to analyze or trying to find a workaround from that angle is a waste of time. About the specific issue reported here: I think we currently only have umm and eboot as C code, and nothing else, so my inclination is to just close. However, I'll leave it open for now to track double checking the warnings you reported in case they warrant a clean up. |
Well those were the ones I did check for in my own code and are indeed the most obvious ones for these kind of build issues. |
I added -Wstrict-prototypes to platform.txt and built a bunch of examples and there were no warnings emitted, at all, even for ones that built files listed in your log:
If you look at your dump, you'll see the files are cpp extension, but are still being built with Looks like PIO is compiling C++ files with Closing as nothing to do on the Arduino 8266 side, and we've had chime-ins from us and igrr that the lack of |
So just to get this right, PlatformIO is using a different compiler compared to ArduinoIDE? |
That's what it looks like, but I can't say for sure since I could never get it working right for me. I suggest you do a clean build from scratch with dumped command lines to see exactly what it's calling. |
But what if it is indeed compiling using gcc, could these warnings be valid? |
No. In C++ when a function proto has |
I think PIO is using the same compiler (at least I fervently hope so), just a different build system and/or different compile flags than our standard Arduino way. |
Basic Infos
Platform
Problem Description
As discussed here: platformio/platform-espressif8266#166 (comment)
The suggested fix by @ascillato for PlatformIO build issues is to add
(void)
in function declarations without parameters, just like in C.This made me look into the reasons behind it and I came across this warning option for gcc:
To get gcc to warn about empty parameter lists, use
-Wstrict-prototypes
:So I applied it also to my PlatformIO environment and came across a number of warnings in the code of this library.
The fixes are rather trivial, but I wonder also whether these kind of issues can lead to build issues as described in the linked issue of PlatformIO ?
The text was updated successfully, but these errors were encountered: