zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
9.74k stars 6k forks source link

tests/lib/cpp/cxx/: extend .h coverage to CONFIG_PM and basic device tree #72203

Closed marc-hb closed 2 weeks ago

marc-hb commented 2 weeks ago

Extend the coverage of tests/lib/cpp/cxx/ to more .h files.

3 commits, see commit messages for details.

This is a subset of #70403, see that PR for more context.

The extra coverage catches issues like disordered designated initializers in .h files; see fix below.

C++20 now supports designated initializers but in a way much more restricted than C. tests/lib/cpp/cxx/testcase.yaml has the unique ability to test multiple CONFIG_STD_CPPxx version at once, very convenient.

In a surprising twist, gcc in C++20 mode can fail to compile code that worked in C++17 mode because the latter accepted whatever designated initializers C99 accepted...