Skip to content
Commit c15f029a authored by Marc Herbert's avatar Marc Herbert Committed by David Leach
Browse files

init.h: restore designated initializers in SYS_INIT_NAMED()



As seen in the PR #68125 discussion, commit 19a33c78 ("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: default avatarMarc Herbert <marc.herbert@intel.com>
parent 5b6fadc1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment