Skip to content
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

Fix -Wreturn-type and its undefined behavior #2043

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

Arusekk
Copy link
Contributor

@Arusekk Arusekk commented Jul 28, 2020

Silence the following warning message:

src/NotesWriterSM.cpp:260:11: warning: control reaches end of non-void function [-Wreturn-type]

This warning had meaningful implications for some reason.
When I compiled the current version with stack protector enabled, GCC optimized out successful return from the function, and encouraged undefined behavior far less intuitive than an unspecified value.

Whenever saving a steps file on a -DCMAKE_BUILD_TYPE=Release build, the game printed a message about stack protection violation, and aborted itself, even though no violation took place.

GCC version:
gcc (Gentoo 10.2.0 p1) 10.2.0

Silence the following warning message:
src/NotesWriterSM.cpp:260:11: warning: control reaches end of non-void function [-Wreturn-type]

This warning had meaningful implications for some reason.
When I compiled the current version with stack protector enabled,
GCC optimized out successful return from the function, and encouraged
undefined behavior far less intuitive than an unspecified value.

Whenever saving a steps file on a -DCMAKE_BUILD_TYPE=Release build,
the game printed a message about stack protection violation,
and aborted itself, even though no violation took place.

GCC version:
gcc (Gentoo 10.2.0 p1) 10.2.0
@quietly-turning
Copy link
Contributor

Thanks for another patch, @Arusekk!

Similar to #2012, this is outside my working knowledge, but perhaps this comment can draw the attention of any active devs who are more familiar with it. 🙂

@shakesoda
Copy link
Member

shakesoda commented Sep 15, 2020 via email

@quietly-turning
Copy link
Contributor

Thanks, shake. 👍

@quietly-turning quietly-turning merged commit 3968c94 into stepmania:5_1-new Sep 15, 2020
@Arusekk Arusekk deleted the wreturn-type branch September 17, 2020 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants