On Mon, Dec 08, 2025 at 07:28:53PM -0800, H. Peter Anvin wrote:

> Yeah... the C committee even admitted they botched the spec; the intent was 
> for it to work "exactly like gcc __auto_type"...

BTW, speaking of C23 fun that is supported by gcc 8, but not by sparse:
__has_include().

Do we want it?  At the moment nothing in the kernel is using that thing.
The main case for that would be <asm/something_optional.h>, and mostly
it's dealt with by dummy asm-generic/something_optional.h and mandatory-y
in asm-generic/Kbuild, but there are at least some cases where we have
it guarded by ifdef, a-la
#ifdef CONFIG_ARCH_HAS_ELFCORE_COMPAT
#include <asm/elfcore-compat.h>
#endif

Linus?  Seeing that I'm touching pre-process.c anyway for the sake of
__VA_OPT__, adding that thing ought to be reasonably easy - a bit of
work in expression_value(), the tricky part being where to stop the
scan: __has_include(< => scan to > and demand ) after it,
__has_include(string literal => demand ) after it,
__has_include(anything else => scan to matching ), and expand the
collected tokens.  The same dodge we use for #include ("anything
potentially fishy in header-name and it's an UB, so one can
simulate it with other pp-tokens") works here...

Reply via email to