commit | f816e851eec80004e18ea2829c18be1eb95004aa | [log] [tgz] |
---|---|---|
author | Jonathon Reinhart <jrreinhart@google.com> | Wed Feb 28 18:46:42 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Feb 28 18:46:42 2024 +0000 |
tree | 19d6dddaa4ecd975a11a701884f298f14394acaa | |
parent | c76277cc6e7c7ea5a021606365c7872058b4ceb4 [diff] |
pw_assert_log: Fix PW_HANDLE_CRASH to handle 0 args PW_HANDLE_CRASH() currently passes all of its variadic arguments to PW_HANDLE_LOG() via __VA_ARGS__. Depending on the logging backend's implementation of PW_HANDLE_LOG(), this can cause an extraneous trailing comma in the argument list. This was the case with pw_log_android which forwards its args to LOG_ALWAYS_FATAL(), resulting in an extra comma in the call to __android_log_assert(). We can simply drop the `message` macro parameter and let it be (optionally!) passed via __VA_ARGS__ where it will be concatenated to the "Crash: " literal. If there are no additional args, there will be no additional comma. This actually makes it consistent with all other PW_HANDLE_CRASH(...) backends. Test: Compile code using PW_CRASH("Foo") in Android using pw_assert_log and pw_log_android. Bug: b/327201811 Change-Id: Id43242c00c049459146952af88fa34c9176c36e9 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/194450 Reviewed-by: Wyatt Hepler <hepler@google.com> Commit-Queue: Jonathon Reinhart <jrreinhart@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.