-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Change declaration order to address GCC 12.1 error #18385
Change declaration order to address GCC 12.1 error #18385
Conversation
GCC 12.1 complains: ``` ../../src/messaging/ExchangeMgr.cpp: In constructor ‘chip::Messaging::ExchangeManager::ExchangeManager()’: ../../src/messaging/ExchangeMgr.cpp:62:58: error: member ‘chip::Messaging::ExchangeManager::mContextPool’ is used uninitialized [-Werror=uninitialized] 62 | ExchangeManager::ExchangeManager() : mReliableMessageMgr(mContextPool) | ^~~~~~~~~~~~ At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors ``` Make sure mContextPool comes before mReliableMessageMgr in the declaration order.
My C++ is not very fluent, but it seems declaration order matters? I wonder why this wasn't problematic before... Maybe compilers reordered based on member initializer list? |
PR #18385: Size comparison from cb116b9 to 9fa372e Increases (22 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, nrfconnect, p6, telink)
Decreases (6 builds for cc13x2_26x2, linux)
Full report (34 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
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.
That is a very useful error.
Problem
GCC 12.1 complains:
Change overview
Make sure mContextPool comes before mReliableMessageMgr in the
declaration order.
Testing
Manually, just compiling.