summaryrefslogtreecommitdiff
path: root/include/support
diff options
context:
space:
mode:
Diffstat (limited to 'include/support')
-rw-r--r--include/support/android/locale_bionic.h4
-rw-r--r--include/support/win32/locale_win32.h11
-rw-r--r--include/support/win32/math_win32.h117
-rw-r--r--include/support/win32/support.h22
-rw-r--r--include/support/xlocale/__posix_l_fallback.h4
5 files changed, 10 insertions, 148 deletions
diff --git a/include/support/android/locale_bionic.h b/include/support/android/locale_bionic.h
index 1365563ee4815..482e234335852 100644
--- a/include/support/android/locale_bionic.h
+++ b/include/support/android/locale_bionic.h
@@ -11,7 +11,7 @@
#ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
#define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
-#if defined(__ANDROID__)
+#if defined(__BIONIC__)
#ifdef __cplusplus
extern "C" {
@@ -27,5 +27,5 @@ extern "C" {
#include <support/xlocale/__posix_l_fallback.h>
#include <support/xlocale/__strtonum_fallback.h>
-#endif // defined(__ANDROID__)
+#endif // defined(__BIONIC__)
#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h
index 7f3710ecc1881..0f5527e570ab9 100644
--- a/include/support/win32/locale_win32.h
+++ b/include/support/win32/locale_win32.h
@@ -17,7 +17,6 @@ extern "C" unsigned short __declspec(dllimport) _ctype[];
#include "support/win32/support.h"
#include "support/win32/locale_mgmt_win32.h"
#include <stdio.h>
-#include <memory>
lconv *localeconv_l( locale_t loc );
size_t mbrlen_l( const char *__restrict s, size_t n,
@@ -34,21 +33,19 @@ size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src,
size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
wint_t btowc_l( int c, locale_t loc );
int wctob_l( wint_t c, locale_t loc );
-typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
-typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
inline _LIBCPP_ALWAYS_INLINE
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
{
- __locale_raii __current( uselocale(__l), uselocale );
- return MB_CUR_MAX;
+ return ___mb_cur_max_l_func(__l);
}
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
#define mbtowc_l _mbtowc_l
#define strtoll_l _strtoi64_l
#define strtoull_l _strtoui64_l
-// FIXME: current msvcrt does not know about long double
-#define strtold_l _strtod_l
+#define strtof_l _strtof_l
+#define strtod_l _strtod_l
+#define strtold_l _strtold_l
inline _LIBCPP_INLINE_VISIBILITY
int
diff --git a/include/support/win32/math_win32.h b/include/support/win32/math_win32.h
deleted file mode 100644
index 0d6b422a165cf..0000000000000
--- a/include/support/win32/math_win32.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// -*- C++ -*-
-//===---------------------- support/win32/math_win32.h --------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
-
-#if !defined(_LIBCPP_MSVCRT)
-#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
-#else
-
-#include <math.h>
-#include <float.h> // _FPCLASS_PN etc.
-#include <crtversion.h>
-
-#if ((_VC_CRT_MAJOR_VERSION-0) < 12)
-// Necessary?
-typedef float float_t;
-typedef double double_t;
-
-_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
-{
- return _finite(num) != 0;
-}
-_LIBCPP_ALWAYS_INLINE bool isinf( double num )
-{
- return !isfinite(num) && !_isnan(num);
-}
-_LIBCPP_ALWAYS_INLINE bool isnan( double num )
-{
- return _isnan(num) != 0;
-}
-_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
-{
- int class_ = _fpclass(num);
- return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x > y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x >= y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x < y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
-{
- if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
- else return x <= y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
-{
- if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
- else return x < y || x > y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
-{
- return isnan(x) || isnan(y);
-}
-_LIBCPP_ALWAYS_INLINE bool signbit( double num )
-{
- switch(_fpclass(num))
- {
- case _FPCLASS_SNAN:
- case _FPCLASS_QNAN:
- case _FPCLASS_NINF:
- case _FPCLASS_NN:
- case _FPCLASS_ND:
- case _FPCLASS_NZ:
- return true;
- case _FPCLASS_PZ:
- case _FPCLASS_PD:
- case _FPCLASS_PN:
- case _FPCLASS_PINF:
- return false;
- }
- return false;
-}
-_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
-{
- return (signbit (x) != signbit (y) ? - x : x);
-}
-_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
-{
- return ::_copysign(x,y);
-}
-_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
-{
- return ::_copysignl(x,y);
-}
-_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
-{
- return _fpclass(num);
-}
-#endif
-#endif // _LIBCPP_MSVCRT
-
-#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
index 5765babcd13b5..6a5763b5e49b9 100644
--- a/include/support/win32/support.h
+++ b/include/support/win32/support.h
@@ -22,7 +22,7 @@
#include <intrin.h>
#endif
#if defined(_LIBCPP_MSVCRT)
-#include <xlocinfo.h>
+#include <crtversion.h>
#endif
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
@@ -44,26 +44,8 @@ size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
}
#endif // __MINGW32__
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14
#define snprintf _snprintf
-#define atoll _atoi64
-#define strtoll _strtoi64
-#define strtoull _strtoui64
-#define wcstoll _wcstoi64
-#define wcstoull _wcstoui64
-_LIBCPP_ALWAYS_INLINE float strtof(const char *nptr, char **endptr)
-{
- return _Stof(nptr, endptr, 0);
-}
-_LIBCPP_ALWAYS_INLINE double strtod(const char *nptr, char **endptr)
-{
- return _Stod(nptr, endptr, 0);
-}
-_LIBCPP_ALWAYS_INLINE long double strtold(const char *nptr, char **endptr)
-{
- return _Stold(nptr, endptr, 0);
-}
-
#define _Exit _exit
#endif
diff --git a/include/support/xlocale/__posix_l_fallback.h b/include/support/xlocale/__posix_l_fallback.h
index 8bf9567ffc255..c893a67313cc8 100644
--- a/include/support/xlocale/__posix_l_fallback.h
+++ b/include/support/xlocale/__posix_l_fallback.h
@@ -124,11 +124,11 @@ inline _LIBCPP_ALWAYS_INLINE int tolower_l(int c, locale_t) {
return ::tolower(c);
}
-inline _LIBCPP_ALWAYS_INLINE int towupper_l(int c, locale_t) {
+inline _LIBCPP_ALWAYS_INLINE wint_t towupper_l(wint_t c, locale_t) {
return ::towupper(c);
}
-inline _LIBCPP_ALWAYS_INLINE int towlower_l(int c, locale_t) {
+inline _LIBCPP_ALWAYS_INLINE wint_t towlower_l(wint_t c, locale_t) {
return ::towlower(c);
}