-
Notifications
You must be signed in to change notification settings - Fork 8k
treewide: Enforce C17 as the minimum required C standard #97076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@stephanosio @nashif @keith-packard should we also enforce C++17 at the same time, for consistency? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to drop these compiler feature flags? This will require all out-of-tree dependencies to drop this (even if they do support an older C standard version?).
I think this can remain, as newer standards should support older flags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
Yes they should remain, cause they go into a list to tell CMake what standard features are available.
And there we should include old ones.
Some (external) code might do: target_compile_features(foo PRIVATE c_std_99)
which is perfectly valid cause that just means code requires feature from c99, which is also supported by c17 (our new default).
@nashif You may want to consider switching to MISRA C:2012 Amendment 3 as a basis for the guidelines after updating the baseline C standard version, since that edition of the guidelines have much better coverage of C17 than Amendment 2 (e.g. it has guidelines for the safe use of |
DNM until we have verified all prequisites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep code in compiler_features.cmake.
The list should still include old standards as that will allow downstream users to request those as required (and it's support when using newer c17 std)
@carlescufi for tracking purposes, can you please link to the decision in question? I am not questioning that a decision has been made, but I am having a hard time tracking down when/where so I can only imagine it's even harder for mere mortals to find that information. |
A few spacing mistakes. Signed-off-by: Carles Cufi <[email protected]>
C99 has been the minimum required C standard version for Zephyr since its inception. After multiple attempts and discussions, a decision has been made to upgrade to C17 going forward. This commits replaces the default C standard from C99 to C17 in the configuration and build system. Signed-off-by: Carles Cufi <[email protected]>
As part of the transition from C99 to C17 as the minimum supported C standard version, remove the workarounds in the formatted output subsystem to maintain compatibility with toolchains that do not support the _Generic keyword. Signed-off-by: Carles Cufi <[email protected]>
ac7d69d
to
fe18301
Compare
|
It's now linked to in the text of #97061 |
C99 has been the minimum required C standard version for Zephyr since its inception. After multiple attempts and discussions, a decision has been made to upgrade to C17 going forward.
This commits replaces the default C standard from C99 to C17 in the configuration and build system.
Closes #97061