diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -27,6 +27,7 @@ __tree __tuple __undef_macros + __undef_macros_private algorithm any array @@ -121,6 +122,7 @@ math.h memory module.modulemap + module.private.modulemap mutex new numbers diff --git a/libcxx/include/__bits b/libcxx/include/__bits --- a/libcxx/include/__bits +++ b/libcxx/include/__bits @@ -17,7 +17,7 @@ #endif _LIBCPP_PUSH_MACROS -#include <__undef_macros> +#include <__undef_macros_private> _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h --- a/libcxx/include/__memory/allocator_traits.h +++ b/libcxx/include/__memory/allocator_traits.h @@ -13,7 +13,7 @@ #include <__config> #include <__memory/base.h> #include <__memory/pointer_traits.h> -#include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h --- a/libcxx/include/__memory/pointer_traits.h +++ b/libcxx/include/__memory/pointer_traits.h @@ -11,7 +11,7 @@ #define _LIBCPP___MEMORY_POINTER_TRAITS_H #include <__config> -#include +#include <__memory/base.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/libcxx/include/__memory/utilities.h b/libcxx/include/__memory/utilities.h --- a/libcxx/include/__memory/utilities.h +++ b/libcxx/include/__memory/utilities.h @@ -12,7 +12,6 @@ #include <__config> #include <__memory/allocator_traits.h> -#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/libcxx/include/__sso_allocator b/libcxx/include/__sso_allocator --- a/libcxx/include/__sso_allocator +++ b/libcxx/include/__sso_allocator @@ -11,9 +11,8 @@ #define _LIBCPP___SSO_ALLOCATOR #include <__config> -#include -#include #include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header diff --git a/libcxx/include/__undef_macros_private b/libcxx/include/__undef_macros_private new file mode 100644 --- /dev/null +++ b/libcxx/include/__undef_macros_private @@ -0,0 +1,33 @@ +// -*- C++ -*- +//===------------------------ __undef_macros ------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + + +#ifdef min +#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) +#if defined(_LIBCPP_WARNING) +_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX " + "before any Windows header. #undefing min") +#else +#warning: macro min is incompatible with C++. #undefing min +#endif +#endif +#undef min +#endif + +#ifdef max +#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS) +#if defined(_LIBCPP_WARNING) +_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX " + "before any Windows header. #undefing max") +#else +#warning: macro max is incompatible with C++. #undefing max +#endif +#endif +#undef max +#endif diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -1,10 +1,3 @@ -// define the module for __config outside of the top level 'std' module -// since __config may be included from C headers which may create an -// include cycle. -module std_config [system] [extern_c] { - header "__config" -} - module std [system] { export std_config // FIXME: The standard does not require that each of these submodules @@ -522,7 +515,6 @@ } // FIXME: These should be private. - module __bits { header "__bits" export * } module __bit_reference { header "__bit_reference" export * } module __debug { header "__debug" export * } module __errc { header "__errc" export * } @@ -538,6 +530,10 @@ module __tuple { header "__tuple" export * } module __undef_macros { header "__undef_macros" export * } module __node_handle { header "__node_handle" export * } + module __memory_pointer_traits { header "__memory/pointer_traits.h" export * } + module __memory_allocator_traits { header "__memory/allocator_traits.h" export * } + module __memory_base { header "__memory/base.h" export * } + module __memory_utilities { header "__memory/utilities.h" export * } module experimental { requires cplusplus11 diff --git a/libcxx/include/module.private.modulemap b/libcxx/include/module.private.modulemap new file mode 100644 --- /dev/null +++ b/libcxx/include/module.private.modulemap @@ -0,0 +1,6 @@ +module std_Private { + + module __bits { header "__bits" export * } + + module __undef_macros_private { header "__undef_macros_private" export * } +}