summaryrefslogtreecommitdiffstats
path: root/libcxx/src/support/win32
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2016-09-15 18:36:13 +0000
committerShoaib Meenai <smeenai@fb.com>2016-09-15 18:36:13 +0000
commitf6eea04cd134ebc149017f68d5b33b73113bdd0c (patch)
treee9c968735f506d3e63dff9748867ca6d835c0d08 /libcxx/src/support/win32
parent06a67ba57d438066b3c679d5ee52dbe90ea8a605 (diff)
downloadbcm5719-llvm-f6eea04cd134ebc149017f68d5b33b73113bdd0c.tar.gz
bcm5719-llvm-f6eea04cd134ebc149017f68d5b33b73113bdd0c.zip
[libc++] Avoid <memory> include in locale_win32.h
When `_LIBCPP_NO_EXCEPTIONS` is defined, we end up with compile errors when targeting MSVCRT: * Code includes `<new>` * `<new>` includes `<cstdlib>` in order to get `abort` * `<cstdlib>` includes `<stdlib.h>`, _before_ the `using ::abort` * `<stdlib.h>` includes `locale_win32.h` * `locale_win32.h` includes `<memory>` * `<memory>` includes `<stdexcept>` * `<stdexcept>` includes `<cstdlib` for `abort`, but that inclusion gets (correctly) ignored because of header guards * `<stdexcept>` references `_VSTD::abort`, which isn't declared The easiest solution is to make `locale_win32.h` not include `<memory>`, by removing the use of `unique_ptr` and manually restoring the locale instead. Differential Revision: https://reviews.llvm.org/D24374 llvm-svn: 281641
Diffstat (limited to 'libcxx/src/support/win32')
-rw-r--r--libcxx/src/support/win32/locale_win32.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp
index 5a43743470d..7300451101e 100644
--- a/libcxx/src/support/win32/locale_win32.cpp
+++ b/libcxx/src/support/win32/locale_win32.cpp
@@ -10,6 +10,11 @@
#include <locale>
#include <cstdarg> // va_start, va_end
+#include <memory>
+#include <type_traits>
+
+typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
+typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t /*base*/ )
OpenPOWER on IntegriCloud