diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chrono.cpp | 2 | ||||
-rw-r--r-- | src/condition_variable.cpp | 1 | ||||
-rw-r--r-- | src/ios.cpp | 1 | ||||
-rw-r--r-- | src/locale.cpp | 1 | ||||
-rw-r--r-- | src/mutex.cpp | 1 | ||||
-rw-r--r-- | src/new.cpp | 4 | ||||
-rw-r--r-- | src/strstream.cpp | 1 | ||||
-rw-r--r-- | src/support/win32/locale_win32.cpp | 24 | ||||
-rw-r--r-- | src/support/win32/support.cpp | 11 | ||||
-rw-r--r-- | src/system_error.cpp | 2 | ||||
-rw-r--r-- | src/thread.cpp | 2 |
11 files changed, 34 insertions, 16 deletions
diff --git a/src/chrono.cpp b/src/chrono.cpp index 9b277a610cd25..d0e184ad32fb6 100644 --- a/src/chrono.cpp +++ b/src/chrono.cpp @@ -37,7 +37,7 @@ #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN #define VC_EXTRA_LEAN -#include <Windows.h> +#include <windows.h> #if _WIN32_WINNT >= _WIN32_WINNT_WIN8 #include <winapifamily.h> #endif diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp index 3f607271b9ebf..2200aefb804d9 100644 --- a/src/condition_variable.cpp +++ b/src/condition_variable.cpp @@ -14,6 +14,7 @@ #include "condition_variable" #include "thread" #include "system_error" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/ios.cpp b/src/ios.cpp index 7c76ca258b264..0f1d88e378f54 100644 --- a/src/ios.cpp +++ b/src/ios.cpp @@ -22,6 +22,7 @@ #include "new" #include "streambuf" #include "string" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/locale.cpp b/src/locale.cpp index 4163c2c0af653..3d61fbede58a2 100644 --- a/src/locale.cpp +++ b/src/locale.cpp @@ -36,6 +36,7 @@ #endif #include <stdlib.h> #include <stdio.h> +#include "__undef_macros" // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. diff --git a/src/mutex.cpp b/src/mutex.cpp index b858e8877ae5c..c36bd5549da8e 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -12,6 +12,7 @@ #include "limits" #include "system_error" #include "include/atomic_support.h" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS diff --git a/src/new.cpp b/src/new.cpp index 21b30740196b0..2b2682fa66177 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -183,7 +183,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC if (static_cast<size_t>(alignment) < sizeof(void*)) alignment = std::align_val_t(sizeof(void*)); void* p; -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr) #else while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0) @@ -256,7 +256,7 @@ void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) ::_aligned_free(ptr); #else ::free(ptr); diff --git a/src/strstream.cpp b/src/strstream.cpp index be94f9c89e837..01523cf45462e 100644 --- a/src/strstream.cpp +++ b/src/strstream.cpp @@ -13,6 +13,7 @@ #include "cstring" #include "cstdlib" #include "__debug" +#include "__undef_macros" _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/src/support/win32/locale_win32.cpp b/src/support/win32/locale_win32.cpp index 28cb4491781f0..13a6eaedacb23 100644 --- a/src/support/win32/locale_win32.cpp +++ b/src/support/win32/locale_win32.cpp @@ -34,6 +34,18 @@ locale_t uselocale( locale_t newloc ) // uselocale returns the old locale_t return old_locale; } + +decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ) +{ +#if defined(_LIBCPP_MSVCRT) + return ___mb_cur_max_l_func(__l); +#else + __libcpp_locale_guard __current(__l); + return MB_CUR_MAX; +#endif +} + + lconv *localeconv_l( locale_t loc ) { __libcpp_locale_guard __current(loc); @@ -109,3 +121,15 @@ int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ) __libcpp_locale_guard __current(loc); return vasprintf( ret, format, ap ); } + +#if !defined(_LIBCPP_MSVCRT) +float strtof_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtof(nptr, endptr); +} + +long double strtold_l(const char* nptr, char** endptr, locale_t loc) { + __libcpp_locale_guard __current(loc); + return strtold(nptr, endptr); +} +#endif diff --git a/src/support/win32/support.cpp b/src/support/win32/support.cpp index e989681a6d5f2..dbd1c4c418aaa 100644 --- a/src/support/win32/support.cpp +++ b/src/support/win32/support.cpp @@ -15,17 +15,6 @@ #include <cstring> // strcpy, wcsncpy #include <cwchar> // mbstate_t -// Some of these functions aren't standard or if they conform, the name does not. - -int asprintf(char **sptr, const char *__restrict format, ...) -{ - va_list ap; - va_start(ap, format); - int result; - result = vasprintf(sptr, format, ap); - va_end(ap); - return result; -} // Like sprintf, but when return value >= 0 it returns // a pointer to a malloc'd string in *sptr. diff --git a/src/system_error.cpp b/src/system_error.cpp index cbbbb5dcd15c4..17f2c9a5ba795 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(_LIBCPP_MSVCRT) +#if defined(_LIBCPP_MSVCRT_LIKE) string do_strerror_r(int ev) { char buffer[strerror_buff_size]; if (::strerror_s(buffer, strerror_buff_size, ev) == 0) diff --git a/src/thread.cpp b/src/thread.cpp index 412a8fa0a6208..550da8ea71f31 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -34,7 +34,7 @@ #if defined(_LIBCPP_WIN32API) #include <windows.h> -#endif // defined(_LIBCPP_WIN32API) +#endif _LIBCPP_BEGIN_NAMESPACE_STD |