-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Switch from gnu99 to gnu11 #13339
Switch from gnu99 to gnu11 #13339
Conversation
Signed-off-by: szubersk <[email protected]>
It may give some problems in future with pre 5.18 kernels, I think. Until now we could build master branch with really old kernels. Should we wait several years? Or are there really strong pros? |
+1 to waiting a while - as much as I'd love to have new conveniences of newer C standards, until we decide to cut off support for pre-C11 kernels, we're gonna need to target the least common denominator. (A CI build target with -std=gnu11 might not be a bad idea, though I'd be pretty surprised if it caught much in practice...) |
A good news is that no compatibility was broken.
and 4.X series compiles well (except for a couple of unrelated to C11 tweaks needed for autoconf). 3.10 doesn't compile due to:
On top of that 3.10 kernels need:
I'm not sure if it is worth to investigate vanilla 3.10 further. RHEL/CentOS have a lot of patches backported to their 3.X kernel lines and those are anywhere near the vanilla counterparts. Bottom line: I couldn't find a single problem related to the newer standard. |
What's with the case - pre 5.18 kernel with buildin zfs with gnu11 code changes? |
Good catch, George. Looks like I completely missed the built-in compilation mode. On the other hand OpenZFS now uses c99 and Linux uses c89. Those two somehow mix together. Maybe there's hope still... EDIT01 |
I know you can override flags in Kbuild - I've done it a lot for playing with SIMD things, among other things. I am worried that, for example, GCC I believe only claims to be near feature parity for C11 with 4.9 and up, and, say, RHEL7 ships and builds their kernels with gcc 4.8.x, so using any feature they don't have yet would go boom. |
I just checked https://gcc.gnu.org/wiki/C11Status says that specifically 3 features of C11 are not supported in GCC 4.8.5 so we lose the customer base provided
This affects RHEL/CentOS 7 users that want to stay vanilla and don't want to take advantage of SCLo/EPEL/other supplementary repos. I can't estimate how many people it would be. They always have a way out of vanilla, they are not cut off. |
It's always been my experience that C standards committee has done an excellent job prioritizing compatibility. And since the OpenZFS code does it best to avoid the grey areas, I'd expect this to Just Work. It's nice to see your testing and the CI results confirm that. That said, I think we want to hold off making this change. My big concern is cross-platform compatibility. We want to retain the ability to easily add this OpenZFS source, with minimal modification, to the FreeBSD repository. My understanding is they use C99 so we'd still only want to use C99 features in the common code. Given that constraint, it makes sense to have the compiler enforce this for us. Additionally, the illumos and MacOS platforms do pull from this tree, moving to something newer could cause them some heartburn*. It's good to know this works on Linux, but unless we have a real compelling reason to move to C11 it's seems preferable to me to stick with C99. At least for now.
|
Thanks Brian for the constructive criticism. Linux landscape seems unaffected, I'll check the impact on illumos and FreeBSD. |
I believe the consensus was to wait a few years and then revisit this, so for the moment I'm going to close it out. @szubersk thanks for investigating this. |
Motivation and Context
To keep up with the times
https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kernel-C89-To-C11
Description
--std=gnu99
->--std=gnu11
How Has This Been Tested?
$ make
Types of changes
Checklist:
Signed-off-by
.