[PATCH] D31798: [libc++] Drop support for CRTs older than VS 2015
This revision was automatically updated to reflect the committed changes. Closed by commit rL299743: [libc++] Drop support for CRTs older than VS 2015 (authored by smeenai). Changed prior to commit: https://reviews.llvm.org/D31798?vs=94468=94476#toc Repository: rL LLVM https://reviews.llvm.org/D31798 Files: libcxx/trunk/include/cmath libcxx/trunk/include/cstdio libcxx/trunk/include/math.h libcxx/trunk/include/support/win32/locale_win32.h libcxx/trunk/include/support/win32/support.h libcxx/trunk/src/locale.cpp libcxx/trunk/src/support/win32/locale_win32.cpp Index: libcxx/trunk/src/locale.cpp === --- libcxx/trunk/src/locale.cpp +++ libcxx/trunk/src/locale.cpp @@ -1109,13 +1109,7 @@ #elif __sun__ return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#if _VC_CRT_MAJOR_VERSION < 14 -// This is assumed to be safe, which is a nonsense assumption because we're -// going to end up dereferencing it later... -return _ctype+1; // internal ctype mask table defined in msvcrt.dll -#else return __pctype_func(); -#endif #elif defined(__EMSCRIPTEN__) return *__ctype_b_loc(); #elif defined(_NEWLIB_VERSION) Index: libcxx/trunk/src/support/win32/locale_win32.cpp === --- libcxx/trunk/src/support/win32/locale_win32.cpp +++ libcxx/trunk/src/support/win32/locale_win32.cpp @@ -13,8 +13,6 @@ #include #include -#include - typedef _VSTD::remove_pointer::type __locale_struct; typedef _VSTD::unique_ptr<__locale_struct, decltype()> __locale_raii; @@ -31,9 +29,8 @@ // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); // uselocale sets all categories -#if _VC_CRT_MAJOR_VERSION < 14 -setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); -#endif +// disable setting locale on Windows temporarily because the structure is opaque (PR31516) +//setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); // uselocale returns the old locale_t return old_locale; } Index: libcxx/trunk/include/support/win32/locale_win32.h === --- libcxx/trunk/include/support/win32/locale_win32.h +++ libcxx/trunk/include/support/win32/locale_win32.h @@ -11,13 +11,6 @@ #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H -#include - -#if _VC_CRT_MAJOR_VERSION < 14 -// ctype mask table defined in msvcrt.dll -extern "C" unsigned short __declspec(dllimport) _ctype[]; -#endif - #include "support/win32/support.h" #include "support/win32/locale_mgmt_win32.h" #include Index: libcxx/trunk/include/support/win32/support.h === --- libcxx/trunk/include/support/win32/support.h +++ libcxx/trunk/include/support/win32/support.h @@ -21,9 +21,6 @@ #if defined(_LIBCPP_COMPILER_MSVC) #include #endif -#if defined(_LIBCPP_MSVCRT) -#include -#endif #define swprintf _snwprintf #define vswprintf _vsnwprintf @@ -44,11 +41,6 @@ } #endif // __MINGW32__ -#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 -#define snprintf _snprintf -#define _Exit _exit -#endif - #if defined(_LIBCPP_COMPILER_MSVC) // Bit builtin's make these assumptions when calling _BitScanForward/Reverse Index: libcxx/trunk/include/math.h === --- libcxx/trunk/include/math.h +++ libcxx/trunk/include/math.h @@ -293,9 +293,6 @@ */ #include <__config> -#if defined(_LIBCPP_MSVCRT) -#include -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -333,7 +330,7 @@ return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY @@ -367,7 +364,7 @@ return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY @@ -673,7 +670,7 @@ // acos -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} #endif @@ -685,7 +682,7 @@ // asin -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x)
[PATCH] D31798: [libc++] Drop support for CRTs older than VS 2015
smeenai created this revision. LLVM dropped support for Visual Studio versions older than 2015 quite some time ago, so I consider it safe to drop libc++'s support for older CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing functions, so targeting it requires less special casing. https://reviews.llvm.org/D31798 Files: include/cmath include/cstdio include/math.h include/support/win32/locale_win32.h include/support/win32/support.h src/locale.cpp src/support/win32/locale_win32.cpp Index: src/support/win32/locale_win32.cpp === --- src/support/win32/locale_win32.cpp +++ src/support/win32/locale_win32.cpp @@ -13,8 +13,6 @@ #include #include -#include - typedef _VSTD::remove_pointer::type __locale_struct; typedef _VSTD::unique_ptr<__locale_struct, decltype()> __locale_raii; @@ -31,9 +29,8 @@ // uselocale sets the thread's locale by definition, so unconditionally use thread-local locale _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); // uselocale sets all categories -#if _VC_CRT_MAJOR_VERSION < 14 -setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); -#endif +// disable setting locale on Windows temporarily because the structure is opaque (PR31516) +//setlocale( LC_ALL, newloc->locinfo->lc_category[LC_ALL].locale ); // uselocale returns the old locale_t return old_locale; } Index: src/locale.cpp === --- src/locale.cpp +++ src/locale.cpp @@ -1109,13 +1109,7 @@ #elif __sun__ return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) -#if _VC_CRT_MAJOR_VERSION < 14 -// This is assumed to be safe, which is a nonsense assumption because we're -// going to end up dereferencing it later... -return _ctype+1; // internal ctype mask table defined in msvcrt.dll -#else return __pctype_func(); -#endif #elif defined(__EMSCRIPTEN__) return *__ctype_b_loc(); #elif defined(_NEWLIB_VERSION) Index: include/support/win32/support.h === --- include/support/win32/support.h +++ include/support/win32/support.h @@ -21,9 +21,6 @@ #if defined(_LIBCPP_COMPILER_MSVC) #include #endif -#if defined(_LIBCPP_MSVCRT) -#include -#endif #define swprintf _snwprintf #define vswprintf _vsnwprintf @@ -44,11 +41,6 @@ } #endif // __MINGW32__ -#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 -#define snprintf _snprintf -#define _Exit _exit -#endif - #if defined(_LIBCPP_COMPILER_MSVC) // Bit builtin's make these assumptions when calling _BitScanForward/Reverse Index: include/support/win32/locale_win32.h === --- include/support/win32/locale_win32.h +++ include/support/win32/locale_win32.h @@ -11,13 +11,6 @@ #ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H #define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H -#include - -#if _VC_CRT_MAJOR_VERSION < 14 -// ctype mask table defined in msvcrt.dll -extern "C" unsigned short __declspec(dllimport) _ctype[]; -#endif - #include "support/win32/support.h" #include "support/win32/locale_mgmt_win32.h" #include Index: include/math.h === --- include/math.h +++ include/math.h @@ -293,9 +293,6 @@ */ #include <__config> -#if defined(_LIBCPP_MSVCRT) -#include -#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -333,7 +330,7 @@ return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY @@ -367,7 +364,7 @@ return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } -#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14) +#elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY @@ -673,7 +670,7 @@ // acos -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} #endif @@ -685,7 +682,7 @@ // asin -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__)) +#if !(defined(_AIX) || defined(__sun__)) inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} #endif @@ -697,7 +694,7 @@ // atan -#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) <