forked from OSchip/llvm-project
[libc++] Improve error messages for disabled modes
We should not surface CMake-level options like LIBCXX_ENABLE_FILESYSTEM to our users, since they don't know what it means. Instead, use a slightly more general wording. Also, add an error in <ios> to improve the quality of errors for people trying to use <iostream> when localization is disabled. Differential Revision: https://reviews.llvm.org/D125910
This commit is contained in:
parent
422ec52438
commit
1c4b31c38b
|
@ -59,7 +59,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
# error <barrier> is not supported on this single threaded system
|
||||
# error "<barrier> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
|
|
|
@ -261,7 +261,7 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
|
|||
#include <version>
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
|
||||
# error "The Filesystem library is not supported since libc++ has been configured with LIBCXX_ENABLE_FILESYSTEM disabled"
|
||||
# error "The <filesystem> library is not supported since libc++ has been configured without support for a filesystem."
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
|
@ -383,8 +383,8 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
|
|||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <future> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
# error "<future> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -2432,6 +2432,4 @@ future<void>::share() _NOEXCEPT
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_FUTURE
|
||||
|
|
|
@ -210,8 +210,13 @@ storage-class-specifier const error_category& iostream_category() noexcept;
|
|||
|
||||
*/
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# error "The iostreams library is not supported since libc++ has been configured without support for localization."
|
||||
#endif
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__ios/fpos.h>
|
||||
#include <__locale>
|
||||
#include <__utility/swap.h>
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
# error <latch> is not supported on this single threaded system
|
||||
# error "<latch> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
|
|
|
@ -36,7 +36,7 @@ Functions:
|
|||
#include <__config>
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# error "The Localization library is not supported since libc++ has been configured with LIBCXX_ENABLE_LOCALIZATION disabled"
|
||||
# error "<locale.h> is not supported since libc++ has been configured without support for localization."
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
|
|
@ -59,7 +59,7 @@ using binary_semaphore = counting_semaphore<1>;
|
|||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
# error <semaphore> is not supported on this single threaded system
|
||||
# error "<semaphore> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
|
|
|
@ -140,8 +140,8 @@ _LIBCPP_PUSH_MACROS
|
|||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <shared_mutex> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
# error "<shared_mutex> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -501,8 +501,6 @@ swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) _NOEXCEPT
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
|
|
@ -105,8 +105,8 @@ _LIBCPP_PUSH_MACROS
|
|||
#include <__undef_macros>
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_THREADS
|
||||
#error <thread> is not supported on this single threaded system
|
||||
#else // !_LIBCPP_HAS_NO_THREADS
|
||||
# error "<thread> is not supported since libc++ has been configured without support for threads."
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -401,8 +401,6 @@ void yield() _NOEXCEPT {__libcpp_thread_yield();}
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_THREAD
|
||||
|
|
Loading…
Reference in New Issue