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

[build] force -Wreturn-type to always trigger an error #2323

Merged
merged 1 commit into from
Jun 2, 2021

Conversation

avtolstoy
Copy link
Member

Problem

Starting with GCC 9 not returning a value from a function declared to return non-void type will cause a hardfault. This is easily overlooked in applications where warnings are not promoted to errors by defaults.

Solution

Force -Wreturn-type to always trigger an error even if building applications where warnings are not promoted to errors.

Steps to Test

Test app should fail to build with an error.

Example App

int test() {
}

/* executes once at startup */
void setup() {
	Log.info("%d", test());
}

/* executes continuously after setup() runs */
void loop() {

}

References

N/A


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

…ng applications where warnings are not promoted to errors
@avtolstoy avtolstoy added this to the 3.1.0 milestone Jun 2, 2021
@avtolstoy avtolstoy requested a review from XuGuohui June 2, 2021 05:25
@avtolstoy avtolstoy merged commit 3bb8e96 into develop Jun 2, 2021
@avtolstoy avtolstoy deleted the fix/return-type-warning branch June 2, 2021 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants