Linux Kernel Readies to Adopt Microsoft C Extensions for ‘Cleaner’ Code
The Linux Kernel developers are preparing to enable Microsoft C Extensions support during kernel compilation. Two patches recently merged into the kbuild-next development tree introduce the compiler flag -fms-extensions for both GCC and LLVM/Clang, allowing the use of non-standard C language constructs traditionally employed in Microsoft Visual C/C++. If accepted without objection, these changes could debut in the Linux 6.19 release.
The -fms-extensions flag permits compilers to recognize Microsoft-specific C constructs — such as anonymous embedding of structures or unions within other structures. Similar proposals have surfaced multiple times on the Linux Kernel Mailing List, only to be rejected each time.
This new initiative, led by Rasmus Villemoes, urges the community to “finally take the leap” and enable Microsoft extensions by default. According to Villemoes, doing so would allow developers to write “cleaner code” and, in certain scenarios, reduce stack usage.
“If we simply decide, as Linus once said, to enable -fms-extensions once and for all, it will always be available whenever a suitable use case arises — without needing to justify it each time,” — Villemoes remarked in a discussion on lore.kernel.org.
A companion patch — “kbuild: Add ‘-fms-extensions’ to areas with dedicated CFLAGS” — ensures that this compiler parameter applies even to architectures using their own compilation flags.
Linus Torvalds himself has previously weighed in on the matter and appears to have no objection to including -fms-extensions in future kernel versions.
If adopted, Linux 6.19 will become the first release officially allowing the use of Microsoft C Extensions. While this could make the kernel codebase appear cleaner, parts of the community may view the move with caution — as it subtly aligns Linux development practices more closely with those of the Microsoft ecosystem.
Support Our Threat Intelligence
If you find our technology report and cybersecurity news helpful, consider supporting our work.