Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
earlephilhower merged 3 commits intoesp8266:masterfromearlephilhower:errorreturn
Jun 24, 2021

Conversation

@earlephilhower
Copy link
Collaborator

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

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
Copy link
Contributor

dok-net commentedJun 23, 2021
edited
Loading

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
Copy link
Collaborator

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.

Notice it is not just -W, but -Werror. Turns out gcc can selectively pick warnings to be treated as errors

dok-net reacted with thumbs up emoji

@dok-net
Copy link
Contributor

@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 (warning: no return statement in function returning non-void [-Wreturn-type])?

@me-no-dev
Copy link
Collaborator

@dok-net I will accept the same change in the ESP32 repo 😄

@dok-net
Copy link
Contributor

@me-no-dev Before moving over there (sorry ESP8266 guys for talking about ESP32 here), you recently said:

all of the changes that you have made are to files that are auto generated by the lib builder. They will not stick. The lib builder get's the flags from IDF's compile process.

The files wereplatform.txt, andtools/platformio-build-esp32*.py.
Predictably, now I am confused, shall I PR a change to these files in the ESP32 repo or not? Mind you, I am not familiar with "the lib builder" or the IDF.

@me-no-dev
Copy link
Collaborator

just-Werror=return-type can be added to platform.txt. Nothing else from your previous PR

@dok-net
Copy link
Contributor

dok-net commentedJun 24, 2021
edited
Loading

@earlephilhower This is from ESP32,

compiler.warning_flags.more=-Wall -Werror=allcompiler.warning_flags.all=-Wall -Werror=all -Wextra

What do you think about-Werror=all forflags.more andflags.all, respectively? I can't image there is any difference between ESP8266 and ESP32 that requires this difference? Of course this is before this PR, but I'm just about to duplicate that to ESP32, so I could use some guidance on whether to make this the same.

Copy link
Collaborator

@mcsprmcspr left a 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

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.

earlephilhower reacted with thumbs up emoji
@earlephilhowerearlephilhower added this to the3.0.1 milestoneJun 24, 2021
@earlephilhowerearlephilhower merged commit90b4c6f intoesp8266:masterJun 24, 2021
@earlephilhowerearlephilhower deleted the errorreturn branchJune 24, 2021 19:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mcsprmcsprmcspr left review comments

@d-a-vd-a-vd-a-v approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

3.0.1

Development

Successfully merging this pull request may close these issues.

5 participants

@earlephilhower@dok-net@mcspr@me-no-dev@d-a-v

[8]ページ先頭

©2009-2025 Movatter.jp