|author||Tom Craig <email@example.com>||Wed Jan 25 05:24:06 2023 +0000|
|committer||CQ Bot Account <firstname.lastname@example.org>||Wed Jan 25 05:24:06 2023 +0000|
pw_protobuf: Codegen kConstantCase field enums pw_protobuf generated code includes an "enum class Fields : uint32_t" type in in message, with values equal to the IDs for each field in the message. Unfortunately, the existing generated code uses SNAKE_CASE for the names, rather than kConstantCase. In addition to be against the style guide, this makes collisions with legacy C macros much more likely. Indeed, I ran into this issue due to a naming collison on OUTPUT_TYPE between stm32cube.h and descriptor.pwpb.h. Of course, ST deserves significant blame here for using inadequately namespaced global identifiers... it's not just pw_protobuf's fault for not using kConstantCase. This commit does not yet migrate pigweed code to use the kConstantCase values, that will be in an immediate follow-on. However, this commit DOES add a GN variable to control generation of the legacy names (in addition to new names): pw_protobuf_compiler_GENERATE_LEGACY_ENUM_SNAKE_CASE_NAMES This currently defaults to true, but will change to default to false after the follow-on commit which migrates upstream pigweed away from SNAKE_CASE. That will have to be done by an upstream pigweed developer. Bug: b/266298474 Change-Id: I460a7d203905d39d234d3bf1a7621b52b188c109 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126804 Commit-Queue: Wyatt Hepler <email@example.com> Reviewed-by: Wyatt Hepler <firstname.lastname@example.org>
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/.