-
Notifications
You must be signed in to change notification settings - Fork 3k
SerialBase.h|cpp [-Wreorder] compiler warning fix #11839
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
Conversation
@JanneKiiskila, thank you for your changes. |
drivers/source/SerialBase.cpp
Outdated
_rx_enabled(true), | ||
_tx_enabled(true), | ||
_tx_pin(tx), | ||
_rx_pin(rx), |
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.
,
needs to be with #if DEVICE_SERIAL_FC
or you can change the declaration order in .h
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.
Ah yes, missed that possibility. Good that we have CI.
Fixed it by re-ordering, force pushing a fix.
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.
Counter-suggestion - prevent future messing around by changing this to C++11.
Put the initialisers in the member declarations:
#if DEVICE_SERIAL_FC
Flow _flow_type = Disabled;
etc
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.
Makes sense, definitely! Thanks!
a6d185d
to
1fed013
Compare
331aa0f
to
159b2c5
Compare
159b2c5
to
dba19e2
Compare
This fixes: ``` [Warning] SerialBase.h@351,22: 'mbed::SerialBase::_flow2' will be initialized after [-Wreorder] [Warning] SerialBase.h@343,22: 'bool mbed::SerialBase::_rx_enabled' [-Wreorder] [Warning] SerialBase.cpp@26,1: when initialized here [-Wreorder] ``` by using C++11 style initializer for SerialBase Kudos to Kevin Bracey, as her his suggestion - we can drop the initializer list if we just set the values directly in the SerialBase.h. No need to worry about the "right order" after that.
dba19e2
to
916b91f
Compare
Squashed, force pushed. |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
This is sitting on top of #10924 which is currently targeting 6.0 |
Description (required)
The initialization order was not quite right, so aligning the .cpp
to match order .h. This hixes the following compiler warning:
Summary of change (What the change is for and why)
Fix compiler warning in SerialBase.h|cpp.
Documentation (Details of any document updates required)
None.
Pull request type (required)
Test results (required)
Release Notes (required for feature/major PRs)
Not worth mentioning in release notes.