> the general expectation that everyone knows the intricacies of GCC to properly understand the kernel code is misplaced IMO
But this isn't just a person trying to properly understand the kernel code. It's someone who's trying to merge a change that's motivated by following a standard. If you're making a change to code based on a standard then yeah, you should know the intricacies of how the compiler implements that standard. Because, as Linus keeps coming back to, that's reality, that's what's actually going to impact users and other devs: the intricacies.
This change strictly makes the Linux kernel more in line with the C Standard, so it may compile better in CLang.
There's literally nothing wrong here. The code is more correct and more conformant with the C-Standard. So why is Linus against it?
Hint: he really isn't. Linus accepted the code anyway.
I dunno, the more and more I look into this, the more I feel like its just another example of Linus unnecessarily flaming someone on the developer communication channels.
Well Linus says that he's not against the code but the reasoning in the original post and I think his whole point is that neither of those arguments are good reasons to make a change. He doesn't specifically mention CLang, so I'm not sure how much he values compiling on that, but he clearly doesn't value conformation to the C Standard. Saying "This change strictly makes the Linux kernel more in line with the C Standard" and concluding there's literally nothing wrong here and that it's strictly more correct this way seems to be the opposite of Linus' opinion, and mine. It's fine to disagree with that, but don't act as if this is just unnecessary flaming by Linus without a purpose.
By removing the non-standard GCC-specific union{} methodology from the code, the contributor necessarily improved portability to CLang. That's just the facts.
Clang now follows GCC's behavior with regard to that specific example, which makes sense, as Clang more or less explicitly aims to correctly compile the GNU dialect of C.
I think it's reasonable (and even important) for Linus to emphasize that the kernel is coded in GNU C, not strictly standards-compliant C.
> Clang more or less explicitly aims to correctly compile the GNU dialect of C
That was super important as the compiler was first starting out, because (A) Apple's existing code was built with GCC, so it relied on GCC flags & extensions, and (B) for it to be a viable open source compiler, it needed to build large existing codebases which were already using GCC.
However, that doesn't mean that Clang will always continue to support every thing GCC does. Whether they by design or by accident, incompatibilities will arise. Of course, projects as tightly coupled to GCC as the Linux kernel might not care.
But this isn't just a person trying to properly understand the kernel code. It's someone who's trying to merge a change that's motivated by following a standard. If you're making a change to code based on a standard then yeah, you should know the intricacies of how the compiler implements that standard. Because, as Linus keeps coming back to, that's reality, that's what's actually going to impact users and other devs: the intricacies.