Contributor
listout

Modern C porting of Gentoo packages


Mentors
Sam James, juippis
Organization
Gentoo Foundation
Technologies
c, c++, cmake, gnu make, clang, musl, glibc
Topics
Porting, musl, Clang, Modern C, C23, patching
Back in 1999, a new revision of the C standard removed several backward compatibility features. However, GCC still accepts these obsolete constructs by default. Support for these constructs is confusing to programmers and potentially affects GCC's ability to implement features from future C standards. But newer versions of compilers (for example Clang 16, expected March 2023) are planning on becoming significantly stricter with the C code they will accept or reject. This is a huge problem for the general Linux ecosystem. Even worse is that some of these failures are silent and lead to incorrect behaviour at runtime. Extra care must be taken to detect this and we must prioritize these cases because they're the most harmful. Also, in the coming years with C2x (likely C23), additional changes like removing certain depreciated prototypes will be made. All of these changes will affect Gentoo packages in the following ways: Lots of packages fail to build with these settings Sometimes packages build successfully but their ./configure scripts have mis-detected features or otherwise made the wrong conclusion about the system because they expect a test to succeed when it now fails.