[libcxx-commits] [libcxx] [libc++] Simplify the implementation of <stddef.h> (PR #86843)

Aaron Ballman via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 15 08:56:06 PDT 2024


AaronBallman wrote:

> Hence, it looks like the Clang builtin headers today completely override any platform-provided <stddef.h> and they exhibit this behavior of always redefining NULL to __null. It certainly seems incorrect to me that the Clang builtin headers are overriding the platform-provided <stddef.h> -- I don't think that behavior is useful.

The issue is modules (what problem can't modules solve?): https://github.com/llvm/llvm-project/blob/7775be4d48e95385c1968d7f1826a11e08f5f954/clang/lib/Headers/__stddef_null.h#L10

Even when `NULL` is already defined, a non-modular build happily redefines `NULL` for you (https://godbolt.org/z/M5YsvjGfP is an example with the header files removed). Prior to that change, we had: https://github.com/llvm/llvm-project/blame/3e6d56617f43f86d65dba04c94277dc4a40c2a86/clang/lib/Headers/__stddef_null.h and that did work: https://godbolt.org/z/qGKfKj9hf

This seems to be a regression between trunk and Clang 18: https://godbolt.org/z/TKTzKThff

CC @ian-twilightcoder 

https://github.com/llvm/llvm-project/pull/86843


More information about the libcxx-commits mailing list