Bug 1119071 - Clean up some code used for older unsupported MSVC versions in MFBT; r=froydnj

This commit is contained in:
Ehsan Akhgari 2015-01-08 10:38:48 -05:00
Родитель 6c043d2ab7
Коммит 039292de5d
8 изменённых файлов: 11 добавлений и 72 удалений

Просмотреть файл

@ -42,14 +42,7 @@
# elif MOZ_USING_LIBCXX && defined(__clang__)
# define MOZ_HAVE_CXX11_ATOMICS
# endif
/*
* Although Visual Studio 2012's CRT supports <atomic>, its atomic load
* implementation unnecessarily uses an atomic intrinsic for the less
* restrictive memory orderings, which can be prohibitively expensive.
* Therefore, we require at least Visual Studio 2013 for using the CRT
* (bug 1061764).
*/
#elif defined(_MSC_VER) && _MSC_VER >= 1800
#elif defined(_MSC_VER)
# if defined(DEBUG)
/*
* Provide our own failure code since we're having trouble linking to

Просмотреть файл

@ -50,18 +50,8 @@
* don't indicate support for them here, due to
* http://stackoverflow.com/questions/20498142/visual-studio-2013-explicit-keyword-bug
*/
# if _MSC_VER >= 1800
# define MOZ_HAVE_CXX11_DELETE
# endif
# if _MSC_VER >= 1700
# define MOZ_HAVE_CXX11_FINAL final
# else
# if defined(__clang__)
# error Please do not try to use clang-cl with MSVC10 or below emulation!
# endif
/* MSVC <= 10 used to spell "final" as "sealed". */
# define MOZ_HAVE_CXX11_FINAL sealed
# endif
# define MOZ_HAVE_CXX11_DELETE
# define MOZ_HAVE_CXX11_FINAL final
# define MOZ_HAVE_CXX11_OVERRIDE
# define MOZ_HAVE_NEVER_INLINE __declspec(noinline)
# define MOZ_HAVE_NORETURN __declspec(noreturn)

Просмотреть файл

@ -31,19 +31,6 @@
# undef MOZ_IS_MSVC
# define MOZ_IS_MSVC 1
/*
* This macro should simplify MSVC version checking. For example, to check
* for VC10 or later, check `#ifdef MOZ_MSVC_VERSION_AT_LEAST(10)`.
*/
# define MOZ_MSVC_VERSION_AT_LEAST(version) \
(version == 10 ? _MSC_VER >= 1600 : \
(version == 11 ? _MSC_VER >= 1700 : \
(version == 12 ? _MSC_VER >= 1800 : \
(version == 13 ? _MSC_VER >= 1900 : \
0))))
# if !MOZ_MSVC_VERSION_AT_LEAST(10)
# error "mfbt (and Gecko) require at least MSVC 2010 RTM to build."
# endif
#endif

Просмотреть файл

@ -25,7 +25,7 @@
# endif
# endif
#elif defined(_MSC_VER)
// The minimum supported MSVC (10, _MSC_VER 1600) supports nullptr.
// The minimum supported MSVC (12, _MSC_VER 1800) supports nullptr.
# define MOZ_HAVE_CXX11_NULLPTR
#endif

Просмотреть файл

@ -38,9 +38,7 @@
# endif
#elif defined(_MSC_VER)
# define MOZ_HAVE_CXX11_ENUM_TYPE
# if _MSC_VER >= 1700
# define MOZ_HAVE_CXX11_STRONG_ENUMS
# endif
# define MOZ_HAVE_CXX11_STRONG_ENUMS
#endif
namespace mozilla {

Просмотреть файл

@ -23,18 +23,13 @@ using mozilla::Swap;
using mozilla::ToMaybe;
using mozilla::UniquePtr;
// Work around a bug in Visual Studio 2010 and 2012 that prevents expressions of
#if MOZ_IS_MSVC
template<typename T> struct Identity { typedef T type; };
# define DECLTYPE(EXPR) Identity<decltype(EXPR)>::type
#elif MOZ_IS_GCC
// Work around a bug in GCC < 4.7 that prevents expressions of
// the form |decltype(foo)::type| from working. See here:
// http://stackoverflow.com/questions/14330768/c11-compiler-error-when-using-decltypevar-followed-by-internal-type-of-var
// GCC < 4.7 also has a similar bug.
#if MOZ_IS_MSVC
# if MOZ_MSVC_VERSION_AT_LEAST(12)
# define DECLTYPE(EXPR) decltype(EXPR)
# else
template<typename T> struct Identity { typedef T type; };
# define DECLTYPE(EXPR) Identity<decltype(EXPR)>::type
# endif
#elif MOZ_IS_GCC
# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
# define DECLTYPE(EXPR) decltype(EXPR)
# else

Просмотреть файл

@ -34,9 +34,7 @@
# endif
# endif
# elif defined(_MSC_VER)
# if _MSC_VER >= 1700
# define MOZ_HAVE_IS_LITERAL
# endif
# define MOZ_HAVE_IS_LITERAL
# endif
#endif

Просмотреть файл

@ -330,24 +330,6 @@ TestReferenceDeleter()
return true;
}
// MSVC10 miscompiles mozilla::RemoveReference<reference to function>, claiming
// that the partial specializations RemoveReference<T&&> and RemoveReference<T&>
// both match RemoveReference<FreeSignature> below. Thus in Mozilla code using
// UniquePtr with a function reference deleter is forbidden. But it doesn't
// hurt to run these tests when the compiler doesn't have problems with this, so
// do so for anything non-MSVC.
#if MOZ_IS_MSVC
// Technically this could be MOZ_MSVC_VERSION_AT_LEAST(11), but we're not
// going to support function deleters as long as we support MSVC10, so it
// hardly matters. In the meantime it's not worth the potential trouble (and
// potential for bustage) to run these tests on MSVC>=11.
# define SHOULD_TEST_FUNCTION_REFERENCE_DELETER 0
#else
# define SHOULD_TEST_FUNCTION_REFERENCE_DELETER 1
#endif
#if SHOULD_TEST_FUNCTION_REFERENCE_DELETER
typedef void (&FreeSignature)(void*);
static size_t DeleteIntFunctionCallCount = 0;
@ -400,8 +382,6 @@ TestFunctionReferenceDeleter()
return true;
}
#endif // SHOULD_TEST_FUNCTION_REFERENCE_DELETER
template<typename T, bool = IsNullPointer<decltype(nullptr)>::value>
struct AppendNullptrTwice;
@ -597,11 +577,9 @@ main()
if (!TestReferenceDeleter()) {
return 1;
}
#if SHOULD_TEST_FUNCTION_REFERENCE_DELETER
if (!TestFunctionReferenceDeleter()) {
return 1;
}
#endif
if (!TestVector()) {
return 1;
}