diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -512,7 +512,6 @@ __support/solaris/floatingpoint.h __support/solaris/wchar.h __support/solaris/xlocale.h - __support/win32/limits_msvc_win32.h __support/win32/locale_win32.h __support/xlocale/__nop_locale_mgmt.h __support/xlocale/__posix_l_fallback.h diff --git a/libcxx/include/__bits b/libcxx/include/__bits --- a/libcxx/include/__bits +++ b/libcxx/include/__bits @@ -22,8 +22,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_COMPILER_MSVC - inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } @@ -70,91 +68,6 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } -#else // _LIBCPP_COMPILER_MSVC - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanForward(&__where, __x)) - return static_cast(__where); - return 32; -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long __x) { - static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); - return __ctz(static_cast(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanForward64(&__where, __x)) - return static_cast(__where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - if (_BitScanForward(&__where, static_cast(__x))) - return static_cast(__where); - if (_BitScanForward(&__where, static_cast(__x >> 32))) - return static_cast(__where + 32); -#endif - return 64; -} - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanReverse(&__where, __x)) - return static_cast(31 - __where); - return 32; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - return __libcpp_clz(static_cast(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&__where, __x)) - return static_cast(63 - __where); -#else - // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. - if (_BitScanReverse(&__where, static_cast(__x >> 32))) - return static_cast(63 - (__where + 32)); - if (_BitScanReverse(&__where, static_cast(__x))) - return static_cast(63 - __where); -#endif - return 64; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) { - static_assert(sizeof(unsigned) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { - static_assert(sizeof(unsigned long) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { - static_assert(sizeof(unsigned long long) == 8, ""); - return __popcnt64(__x); -} - -#endif // _LIBCPP_COMPILER_MSVC - _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -210,20 +210,12 @@ # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) # elif defined(__GNUC__) # define _LIBCPP_COMPILER_GCC -# elif defined(_MSC_VER) -# define _LIBCPP_COMPILER_MSVC # endif # if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" # endif -# ifdef _LIBCPP_COMPILER_MSVC -# error If you successfully use libc++ with MSVC please tell the libc++ developers and consider upstreaming your \ -changes. We are not aware of anybody using this configuration and know that at least some code is currently broken. \ -If there are users of this configuration we are happy to provide support. -# endif - // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, @@ -494,27 +486,7 @@ # define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -# elif defined(_LIBCPP_COMPILER_MSVC) - -# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) - -# if _MSC_VER < 1900 -# error "MSVC versions prior to Visual Studio 2015 are not supported" -# endif - -# define _LIBCPP_NORETURN __declspec(noreturn) - -# define _LIBCPP_WEAK - -# define _LIBCPP_HAS_NO_ASAN - -# define _LIBCPP_ALWAYS_INLINE __forceinline - -# define _LIBCPP_HAS_NO_VECTOR_EXTENSION - -# define _LIBCPP_DISABLE_EXTENSION_WARNING - -# endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC] +# endif // _LIBCPP_COMPILER_[CLANG|GCC] # if defined(_LIBCPP_OBJECT_FORMAT_COFF) @@ -1085,7 +1057,7 @@ # define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ # endif -# if defined(_LIBCPP_ABI_MICROSOFT) && (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) +# if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) # else # define _LIBCPP_DECLSPEC_EMPTY_BASES diff --git a/libcxx/include/__support/win32/limits_msvc_win32.h b/libcxx/include/__support/win32/limits_msvc_win32.h deleted file mode 100644 --- a/libcxx/include/__support/win32/limits_msvc_win32.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H - -#if !defined(_LIBCPP_MSVCRT) -#error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#endif -#if defined(__clang__) -#error "This header should only be included when using Microsoft's C1XX frontend" -#endif - -#include // limit constants -#include // CHAR_BIT -#include // HUGE_VAL -#include // internal MSVC header providing the needed functionality - -#define __CHAR_BIT__ CHAR_BIT - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by MinGW GCC -#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_RADIX__ DBL_RADIX -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by MinGW GCC -#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_RADIX__ LDBL_RADIX -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by MinGW GCC -#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L - -// __builtin replacements/workarounds -#define __builtin_huge_vall() _LInf._Long_double -#define __builtin_nanl(__dummmy) _LNan._Long_double -#define __builtin_nansl(__dummy) _LSnan._Long_double - -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/libcxx/include/bit b/libcxx/include/bit --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -71,10 +71,6 @@ #include #include -#if defined(_LIBCPP_COMPILER_MSVC) -# include -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/include/charconv b/libcxx/include/charconv --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -222,13 +222,7 @@ __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) { static_assert(is_unsigned<_Tp>::value, ""); -#if !defined(_LIBCPP_COMPILER_MSVC) return __builtin_mul_overflow(__a, __b, &__r); -#else - bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a; - __r = __a * __b; - return __did; -#endif } template diff --git a/libcxx/include/limits b/libcxx/include/limits --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -106,10 +106,6 @@ #include <__config> #include -#if defined(_LIBCPP_COMPILER_MSVC) -#include "__support/win32/limits_msvc_win32.h" -#endif // _LIBCPP_MSVCRT - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -141,14 +141,7 @@ : public facet { enum {N = 30}; -#if defined(_LIBCPP_COMPILER_MSVC) -// FIXME: MSVC doesn't support aligned parameters by value. -// I can't get the __sso_allocator to work here -// for MSVC I think for this reason. - vector facets_; -#else vector > facets_; -#endif string name_; public: explicit __imp(size_t refs = 0);