From f656fc588bab4104d531cb46836168da6736a518 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 21 Apr 2016 16:38:06 +0200 Subject: Fix compilation with Visual Studio 2015 Update 2 (static build) Fix linker errors: Qt5Qml.lib(qv4value.obj) : error LNK2005: _nextafter already defined in libucrt.lib(nextafter.obj) Qt5Qml.lib(qv4dateobject.obj) : error LNK2005: _nextafter already defined in libucrt.lib(nextafter.obj) Qt5Qml.lib(qv4runtime.obj) : error LNK2005: _nextafter already defined in libucrt.lib(nextafter.obj) Qt5Qml.lib(qv4globalobject.obj) : error LNK2005: _nextafter already defined in libucrt.lib(nextafter.obj) Qt5Qml.lib(qv4jsonobject.obj) : error LNK2005: _nextafter already defined in libucrt.lib(nextafter.obj) All the defined functions where added in Visual Studio 2013: https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/ Change-Id: Ied924b6c93c6b2f81f2793237c9370a70bd6a60c Reviewed-by: Erik Verbruggen --- src/3rdparty/masm/wtf/Compiler.h | 3 +++ src/3rdparty/masm/wtf/MathExtras.h | 7 +++++++ 2 files changed, 10 insertions(+) (limited to 'src/3rdparty') diff --git a/src/3rdparty/masm/wtf/Compiler.h b/src/3rdparty/masm/wtf/Compiler.h index b886f37151..fc3b5c5c08 100644 --- a/src/3rdparty/masm/wtf/Compiler.h +++ b/src/3rdparty/masm/wtf/Compiler.h @@ -74,12 +74,15 @@ /* COMPILER(MSVC) - Microsoft Visual C++ */ /* COMPILER(MSVC7_OR_LOWER) - Microsoft Visual C++ 2003 or lower*/ /* COMPILER(MSVC9_OR_LOWER) - Microsoft Visual C++ 2008 or lower*/ +/* COMPILER(MSVC12_OR_LOWER) - Microsoft Visual C++ 2013 or lower*/ #if defined(_MSC_VER) #define WTF_COMPILER_MSVC 1 #if _MSC_VER < 1400 #define WTF_COMPILER_MSVC7_OR_LOWER 1 #elif _MSC_VER < 1600 #define WTF_COMPILER_MSVC9_OR_LOWER 1 +#elif _MSC_VER < 1800 +#define WTF_COMPILER_MSVC12_OR_LOWER 1 #endif /* Specific compiler features */ diff --git a/src/3rdparty/masm/wtf/MathExtras.h b/src/3rdparty/masm/wtf/MathExtras.h index 9a85291ae2..9ded0ab736 100644 --- a/src/3rdparty/masm/wtf/MathExtras.h +++ b/src/3rdparty/masm/wtf/MathExtras.h @@ -173,11 +173,15 @@ inline float log2f(float num) inline long long abs(long long num) { return _abs64(num); } #endif +#if COMPILER(MSVC12_OR_LOWER) + inline double nextafter(double x, double y) { return _nextafter(x, y); } inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; } inline double copysign(double x, double y) { return _copysign(x, y); } +#endif // COMPILER(MSVC12_OR_LOWER) + // Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values. inline double wtf_atan2(double x, double y) { @@ -211,6 +215,8 @@ inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); } #define fmod(x, y) wtf_fmod(x, y) #define pow(x, y) wtf_pow(x, y) +#if COMPILER(MSVC12_OR_LOWER) + // MSVC's math functions do not bring lrint. inline long int lrint(double flt) { @@ -233,6 +239,7 @@ inline long int lrint(double flt) return static_cast(intgr); } +#endif // COMPILER(MSVC12_OR_LOWER) #endif // COMPILER(MSVC) inline double deg2rad(double d) { return d * piDouble / 180.0; } -- cgit v1.2.3