[libcxx-commits] [libcxx] [libc++] Remove <stddef.h> includes from the granularized <cstddef> headers (PR #114788)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 5 06:24:58 PST 2024


================
@@ -10,15 +10,14 @@
 #define _LIBCPP___CSTDDEF_NULLPTR_T_H
 
 #include <__config>
-#include <stddef.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-using ::nullptr_t;
+using nullptr_t = decltype(nullptr);
----------------
ldionne wrote:

The big difference is that if the system headers and the compiler disagree about what those types should be, we'll now favour the compiler's definitions whereas we would have previously favoured the system headers (or the Clang builtin headers, depending on which one comes first).

I can't imagine why it would make sense for the compiler and the system library to disagree, but I'm fairly certain there are setups in which they disagree (those setups are probably brittle to the point of being arguably wrong).

So TLDR, it's probably possible for this patch to introduce a behavior change in some weird setups, but I don't think that's something we should take into account beyond recognizing that possibility.

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


More information about the libcxx-commits mailing list