On Sat, Sep 4, 2021 at 12:18 PM Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> wrote: > > And the C standard requires you to use these headers to use some > features of the C language That's really the point here: we don't care AT ALL. The C standard headers are simply not relevant for the kernel. Never have been, never will be. We care about the low-level compiler infrastructure, not the standard C headers. Those standards are designed for - and try to cater to - a completely different audience. We do atomics, and we do not care at all about the mis-designed C++ standard atomics. We do our own type system, and again, we don't care at all about the C "official" type system and odd name rules that change from one version to the other. That has always been the case. We generally *cannot* use the system header files, because they bring in things that the kernel simply cannot handle. That's entirely obvious for things like <stdio.h>, but it's actually true even for other things. > You also need <stdint.h> and <stddef.h>. No, you really don't. We avoid those intentionally, and always have. Because the system header files have never been a good match. Now, <stdarg.h> is actually special for the kernel, exactly because unlike other header files, that one really ended up being something that historically wasn't exposed in any other way and wasn't doable sanely inside the kernel. But it does look like gcc and clang have both ended up exposing the interfaces the same way, using the __buildin_xyz model to just wrap the standard names in a namespace-clean way. That really wasn't historically true. Back in the bad old days of varargs etc, you literally had "va_list" be a "char *" and the accessor functions were magic macros that updated things by hand by the size of the arguments etc... So <stdarg.h> is historically very very special, and tied to compiler implementation details. In ways that a lot of other "standard C header files" very much are *not* - many of those are about the types that the system provides. And in fact often the kernel is the *source* and definition of parts of them. Linus