diff --git a/libcxx/include/format b/libcxx/include/format --- a/libcxx/include/format +++ b/libcxx/include/format @@ -55,14 +55,14 @@ */ +// Make sure all feature tests macros are always available. +#include +// Only enable the contents of the header when libc++ was build with LIBCXX_ENABLE_INCOMPLETE_FEATURES enabled +#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) + #include <__config> #include <__format/format_error.h> #include <__format/format_parse_context.h> -#include - -#if defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) -# error "The Format library is not supported since libc++ has been configured with LIBCXX_ENABLE_INCOMPLETE_FEATURES disabled" -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -81,4 +81,6 @@ _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) + #endif // _LIBCPP_FORMAT diff --git a/libcxx/include/ranges b/libcxx/include/ranges --- a/libcxx/include/ranges +++ b/libcxx/include/ranges @@ -166,6 +166,11 @@ */ +// Make sure all feature tests macros are always available. +#include +// Only enable the contents of the header when libc++ was build with LIBCXX_ENABLE_INCOMPLETE_FEATURES enabled +#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + #include <__config> #include <__ranges/access.h> #include <__ranges/all.h> @@ -188,11 +193,6 @@ #include // Required by the standard. #include // Required by the standard. #include -#include - -#if defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) -# error "The Ranges library is not supported since libc++ has been configured with LIBCXX_ENABLE_INCOMPLETE_FEATURES disabled" -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -211,4 +211,6 @@ _LIBCPP_POP_MACROS +#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) + #endif // _LIBCPP_RANGES