aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__format/format_error.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-07-26 19:03:47 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-07-26 19:04:23 +0000
commit7fa27ce4a07f19b07799a767fc29416f3b625afb (patch)
tree27825c83636c4de341eb09a74f49f5d38a15d165 /libcxx/include/__format/format_error.h
parente3b557809604d036af6e00c60f012c2025b59a5e (diff)
Diffstat (limited to 'libcxx/include/__format/format_error.h')
-rw-r--r--libcxx/include/__format/format_error.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/libcxx/include/__format/format_error.h b/libcxx/include/__format/format_error.h
index 002d1a40a226..f22cb0b81ec2 100644
--- a/libcxx/include/__format/format_error.h
+++ b/libcxx/include/__format/format_error.h
@@ -11,7 +11,7 @@
#define _LIBCPP___FORMAT_FORMAT_ERROR_H
#include <__config>
-#include <cstdlib>
+#include <__verbose_abort>
#include <stdexcept>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -20,35 +20,31 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER >= 20
-class _LIBCPP_EXCEPTION_ABI format_error : public runtime_error {
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
+class _LIBCPP_EXPORTED_FROM_ABI format_error : public runtime_error {
public:
_LIBCPP_HIDE_FROM_ABI explicit format_error(const string& __s)
: runtime_error(__s) {}
_LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s)
: runtime_error(__s) {}
- // TODO FMT Remove when format is no longer experimental.
- // Avoids linker errors when building the Clang-cl Windows DLL which doesn't
- // support the experimental library.
-# ifndef _LIBCPP_INLINE_FORMAT_ERROR_DTOR
- ~format_error() noexcept override;
-# else
- ~format_error() noexcept override {}
-# endif
+ _LIBCPP_HIDE_FROM_ABI_VIRTUAL
+ ~format_error() noexcept override = default;
};
+_LIBCPP_DIAGNOSTIC_POP
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
__throw_format_error(const char* __s) {
-#ifndef _LIBCPP_NO_EXCEPTIONS
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw format_error(__s);
#else
- (void)__s;
- _VSTD::abort();
+ _LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s);
#endif
}
-#endif //_LIBCPP_STD_VER > 17
+#endif //_LIBCPP_STD_VER >= 20
_LIBCPP_END_NAMESPACE_STD