Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init.h: restore designated initializers in SYS_INIT_NAMED()
As seen in the PR zephyrproject-rtos#68125 discussion, commit 19a33c7 ("init: adjust the SYS_INIT dev field init to play nice with older compilers") entirely threw away designated initializers in SYS_INIT_NAMED() to avoid compatibility issues across toolchains. One key aspect that was probably missed at the time: C and C++ are two different languages and this is especially true with respect to designated initializers. Designated initializers provide safer and more readable code, especially in their much stricter C++ version. So use an #ifdef to restore them in SYS_INIT_NAMED() thanks to a small braces difference between C and C++. Signed-off-by: Marc Herbert <[email protected]>
- Loading branch information