- Notifications
You must be signed in to change notification settings - Fork13.3k
Add errors on invalid/missing function return type#8165
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
GCC 10.x seems to have a knack for crashing when a function which is declaredto return a value does not. Add a warning, present on all builds, when thisis the case. For more info seeesp8266#8160Thanks to@hreintke for the tip
dok-net commentedJun 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This warning is basically a must-have on the ESPs. Is there a way to treat it as an error? Because that is what it really is on this architecture, returning from non-void function without a return statement.@earlephilhower That said, then looked at your PR, you have already upgraded it to error, correct? Thanks, this will help me with 3rd party PRs to my libraries as well. |
mcspr commentedJun 23, 2021
Notice it is not just -W, but -Werror. Turns out gcc can selectively pick warnings to be treated as errors |
dok-net commentedJun 23, 2021
@me-no-dev In reference to the now closed discussion aboutespressif/arduino-esp32#5310, would you see any value in this and get it inserted into the right places, instead of the simple warning, that I am already getting for such misuses ( |
me-no-dev commentedJun 24, 2021
@dok-net I will accept the same change in the ESP32 repo 😄 |
dok-net commentedJun 24, 2021
@me-no-dev Before moving over there (sorry ESP8266 guys for talking about ESP32 here), you recently said:
The files were |
me-no-dev commentedJun 24, 2021
just |
dok-net commentedJun 24, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@earlephilhower This is from ESP32, What do you think about |
mcspr left a comment
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.
Also need to update tools/platformio-build.py
Arduino/tools/platformio-build.py
Lines 61 to 87 ind313673
| CFLAGS=[ | |
| "-std=gnu17", | |
| "-Wpointer-arith", | |
| "-Wno-implicit-function-declaration", | |
| "-Wl,-EL", | |
| "-fno-inline-functions", | |
| "-nostdlib" | |
| ], | |
| CCFLAGS=[ | |
| "-Os",# optimize for size | |
| "-mlongcalls", | |
| "-mtext-section-literals", | |
| "-falign-functions=4", | |
| "-U__STRICT_ANSI__", | |
| "-D_GNU_SOURCE", | |
| "-ffunction-sections", | |
| "-fdata-sections", | |
| "-Wall", | |
| "-free", | |
| "-fipa-pta" | |
| ], | |
| CXXFLAGS=[ | |
| "-fno-rtti", | |
| "-std=gnu++17" | |
| ], |
I guess CCFLAGS is the correct choice, based on underlying build system docs:
https://scons.org/doc/latest/HTML/scons-user/apa.html
CCFLAGS
General options that are passed to the C and C++ compilers.
GCC 10.x seems to have a knack for crashing when a function which is declared
to return a value does not. Add a warning, present on all builds, when this
is the case. For more info see
#8160
Thanks to@hreintke for the tip