diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h --- a/libcxx/include/__mbstate_t.h +++ b/libcxx/include/__mbstate_t.h @@ -27,24 +27,24 @@ // This does not define std::mbstate_t -- this only brings in the declaration // in the global namespace. +#if __has_include() +# include // works on most Unixes +#elif __has_include() +# include // works on Darwin +#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next() +// Some older versions of do not define this for clang, so we do it ourselves. // We define this here to support older versions of glibc that do // not define this for clang. This is also set in libc++'s header, // and we need to do so here too to avoid a different function signature given // a different include order. -#ifdef __cplusplus -# define __CORRECT_ISO_CPP_WCHAR_H_PROTO -#endif - -#if __has_include() -# include // works on most Unixes -#elif __has_include() -# include // works on Darwin -#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next() -# include_next // fall back to the C standard provider of mbstate_t +# ifdef __cplusplus +# define __CORRECT_ISO_CPP_WCHAR_H_PROTO +# endif +# include_next // fall back to the C standard provider of mbstate_t #elif __has_include_next() -# include_next // is also required to make mbstate_t visible +# include_next // is also required to make mbstate_t visible #else -# error "We don't know how to get the definition of mbstate_t without on your platform." +# error "We don't know how to get the definition of mbstate_t without on your platform." #endif #endif // _LIBCPP___MBSTATE_T_H diff --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h --- a/libcxx/include/wchar.h +++ b/libcxx/include/wchar.h @@ -116,13 +116,12 @@ # pragma GCC system_header #endif +# if __has_include_next() // We define this here to support older versions of glibc that do // not define this for clang. -#ifdef __cplusplus -#define __CORRECT_ISO_CPP_WCHAR_H_PROTO -#endif - -# if __has_include_next() +# ifdef __cplusplus +# define __CORRECT_ISO_CPP_WCHAR_H_PROTO +# endif # include_next # else # include <__mbstate_t.h> // make sure we have mbstate_t regardless of the existence of