On Apple platforms, some of the stddef.h types are also declared in system headers. In particular NULL has a conflicting declaration in <sys/_types/_null.h>. When that's in a different module from <__stddef_null.h>, redeclaration errors can occur. Make the \_\_stddef_ headers be non-modular in -fbuiltin-headers-in-system-modules and restore them back to not respecting their header guards. Still define the header guards though. __stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the addition of _Builtin_stddef, and it needs to stay in a module because struct's can't be type merged. __stddef_wint_t.h didn't used to have a module, but leave it in it current module since it doesn't really belong to stddef.h.
30 lines
958 B
C++
30 lines
958 B
C++
/*===---- __stddef_nullptr_t.h - Definition of nullptr_t -------------------===
|
|
*
|
|
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
* See https://llvm.org/LICENSE.txt for license information.
|
|
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
*
|
|
*===-----------------------------------------------------------------------===
|
|
*/
|
|
|
|
/*
|
|
* When -fbuiltin-headers-in-system-modules is set this is a non-modular header
|
|
* and needs to behave as if it was textual.
|
|
*/
|
|
#if !defined(_NULLPTR_T) || \
|
|
(__has_feature(modules) && !__building_module(_Builtin_stddef))
|
|
#define _NULLPTR_T
|
|
|
|
#ifdef __cplusplus
|
|
#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
|
|
namespace std {
|
|
typedef decltype(nullptr) nullptr_t;
|
|
}
|
|
using ::std::nullptr_t;
|
|
#endif
|
|
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
|
typedef typeof(nullptr) nullptr_t;
|
|
#endif
|
|
|
|
#endif
|