[libcxx-commits] [libcxx] [libc++] stddef.h needs to #include_next for the new clang __need_ macros (PR #86252)
Ian Anderson via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 21 23:47:46 PDT 2024
https://github.com/ian-twilightcoder created https://github.com/llvm/llvm-project/pull/86252
clang added several __need_ macros to stddef.h that need to be added to the libc++ version as well. clang will also re-enter stddef.h to define rsize_t if __STDC_WANT_LIB_EXT1__ is set, do that in the libc++ one too.
>From 9ac771904c89338af99dda13ee24a91cb30296bc Mon Sep 17 00:00:00 2001
From: Ian Anderson <iana at apple.com>
Date: Thu, 21 Mar 2024 23:45:55 -0700
Subject: [PATCH] [libc++] stddef.h needs to #include_next for the new clang
__need_ macros
clang added several __need_ macros to stddef.h that need to be added to the libc++ version as well. clang will also re-enter stddef.h to define rsize_t if __STDC_WANT_LIB_EXT1__ is set, do that in the libc++ one too.
---
libcxx/include/stddef.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libcxx/include/stddef.h b/libcxx/include/stddef.h
index 887776b150e49d..a3acf0ff10d1b6 100644
--- a/libcxx/include/stddef.h
+++ b/libcxx/include/stddef.h
@@ -7,8 +7,9 @@
//
//===----------------------------------------------------------------------===//
-#if defined(__need_ptrdiff_t) || defined(__need_size_t) || defined(__need_wchar_t) || defined(__need_NULL) || \
- defined(__need_wint_t)
+#if defined(__need_ptrdiff_t) || defined(__need_size_t) || defined(__need_rsize_t) || defined(__need_wchar_t) || \
+ defined(__need_NULL) || defined(__need_nullptr_t) || defined(__need_unreachable) || defined(__need_max_align_t) || \
+ defined(__need_offsetof) || defined(__need_wint_t)
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -16,7 +17,7 @@
# include_next <stddef.h>
-#elif !defined(_LIBCPP_STDDEF_H)
+#elif !defined(_LIBCPP_STDDEF_H) || (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1)
# define _LIBCPP_STDDEF_H
/*
More information about the libcxx-commits
mailing list