-
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
fix(QPG): Enable -Wundef and fix any errors for qpg based builds #29617
Conversation
PR #29617: Size comparison from 2d07e21 to 75afa04 Full report (1 build for cc32xx)
|
PR #29617: Size comparison from 2d07e21 to ecabdb6 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
if (chip_enable_pw_rpc) { | ||
defines = [ "PW_RPC_ENABLED" ] | ||
} | ||
defines = [ "PW_RPC_ENABLED=${chip_enable_pw_rpc}" ] |
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.
I guess the semantics of this macro (boolean value vs just-defined-or-not) are per-platform, so it's OK that this is not necessarily going to be consistent with other platforms?
* @brief Defines if a matter device is acting as a Synchronized Sleepy End Device(SSED) | ||
*/ | ||
#ifndef CHIP_DEVICE_CONFIG_ENABLE_SSED | ||
#define CHIP_DEVICE_CONFIG_ENABLE_SSED 0 |
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.
This is fine, but really this should have gone in CHIPDeviceConfig.h (the core one)... I suspect it will get added there as part of #29613
@@ -184,7 +184,7 @@ CHIP_ERROR CHIP_Init(void) | |||
goto exit; | |||
} | |||
|
|||
#if CONFIG_CHIP_THREAD_SSED | |||
#if defined(CHIP_DEVICE_CONFIG_ENABLE_SSED) && CHIP_DEVICE_CONFIG_ENABLE_SSED |
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.
This on the other hand looks wrong. There is no CHIP_DEVICE_CONFIG_ENABLE_SSED so far (before this PR). What we do have is CHIP_DEVICE_CONFIG_THREAD_SSED on some platforms and CONFIG_CHIP_THREAD_SSED on some platforms, and it's a bit of a mess.
But generally:
- All
CHIP_*CONFIG*
macros must have a specific config header responsible for ensuring they are defined (and pulling in all the headers that might define them). - Consumers of such macros should test them with
#if
and include the responsible header.
The setup here, where defined
is tested, makes it too easy to fail to include the header that actually defines the config and then build different parts of the code with incompatible configurations...
I know the config header setup is really weird; I am only now starting to finally understand how it works. But the above is how it should work. ;)
@@ -1710,7 +1710,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::DoInit(otInstanc | |||
VerifyOrExit(otErr == OT_ERROR_NONE, err = MapOpenThreadError(otErr)); | |||
|
|||
// Enable automatic assignment of Thread advertised addresses. | |||
#if OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE | |||
#if defined(OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE) && OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE |
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.
Again, ideally there would be a specific config header responsible for this that we ensured we included. In practice people put this define in all sorts of random places: project-specific OpenThreadConfig.h, platform-specific CHIPDevicePlatformConfig.h, some openthread-core-cc13x2_26x2-config.h
and bl702-openthread-core-bl-config.h
headers, etc, etc. I have zero confidence this file is ending up including those headers. For example, lots of places are setting openthread_project_core_config_file
but I don't see that being used anywhere.
So as far as I can tell, this change is just covering up a bug: we are not including the things that might define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE in this file.
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.
Follow up created - #29624
…ject-chip#29617) * fix(QPG): Enable -Wundef and fix any errors for qpg based builds (Addresses project-chip#29591) * Restyled by gn --------- Co-authored-by: Restyled.io <[email protected]>
#29591 uncovered errors raised by -Wundef.
This PR addresses all issues found by -Wundef.
Note -Wundef is not enabled by default yet in all builds - flag added to qpg specific gn configuration.
Tested: