From d92c628dd0919944634a87210dbe9aa0c388826d Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sat, 19 Oct 2019 21:21:07 -0700 Subject: [PATCH] Restore compatibility with MSVC 2013. --- CMakeLists.txt | 4 ++-- appveyor.yml | 8 ++++---- core/PRP/KeyedObject/plKey.h | 4 ++-- core/PRP/Surface/plFont.h | 2 +- core/PlasmaDefs.h | 10 ++++++++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e3837263..afa4a895d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,8 @@ endif() if(MSVC) add_definitions("-D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS "/wd4996 /wd4244 /wd4251 ${CMAKE_CXX_FLAGS}") - set(CMAKE_C_FLAGS "/wd4996 /wd4244 /wd4251 ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_C_FLAGS}") endif() # Turn everything on by default diff --git a/appveyor.yml b/appveyor.yml index bff1d015e..ed8093674 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,14 +5,14 @@ environment: PREFIX_VERSION: 20180708 matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - VisualStudioVersion: 14.0 - CMAKE_GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + VisualStudioVersion: 12.0 + CMAKE_GENERATOR: Visual Studio 12 2013 PYTHON_PREFIX: C:\Python27 CMAKE_PARAMS: -DPYTHON_INCLUDE_DIR=C:/Python27/include -DPYTHON_LIBRARY=C:/Python27/libs/python27.lib -DPYTHON_EXECUTABLE=C:/Python27/python.exe - PREFIX_TARGET: vc2015-x86-static + PREFIX_TARGET: vc2013-x86-static DIST_SUFFIX: '%PREFIX_TARGET%-py27' - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 diff --git a/core/PRP/KeyedObject/plKey.h b/core/PRP/KeyedObject/plKey.h index 2b23c8f96..f06a1ecca 100644 --- a/core/PRP/KeyedObject/plKey.h +++ b/core/PRP/KeyedObject/plKey.h @@ -268,7 +268,7 @@ class PLASMA_DLL plKey HS_FINAL plKey(const plKey& init); /** Move constructor */ - plKey(plKey&& move) noexcept : fKeyData(move.fKeyData) + plKey(plKey&& move) HS_NOEXCEPT : fKeyData(move.fKeyData) { move.fKeyData = nullptr; } @@ -307,7 +307,7 @@ class PLASMA_DLL plKey HS_FINAL plKey& operator=(const plKey& other); /** Moves the key ref into this key */ - plKey& operator=(plKey&& other) noexcept + plKey& operator=(plKey&& other) HS_NOEXCEPT { fKeyData = other.fKeyData; other.fKeyData = nullptr; diff --git a/core/PRP/Surface/plFont.h b/core/PRP/Surface/plFont.h index 51c6f98b5..04be752e9 100644 --- a/core/PRP/Surface/plFont.h +++ b/core/PRP/Surface/plFont.h @@ -32,7 +32,7 @@ class PLASMA_DLL plFont : public hsKeyedObject float fLeftKern, fRightKern; public: - plCharacter() noexcept + plCharacter() HS_NOEXCEPT : fBitmapOffset(), fHeight(), fBaseline(), fLeftKern(), fRightKern() { } diff --git a/core/PlasmaDefs.h b/core/PlasmaDefs.h index c5c7dbd98..7ab1d83db 100644 --- a/core/PlasmaDefs.h +++ b/core/PlasmaDefs.h @@ -42,7 +42,13 @@ #define HS_OVERRIDE override #define HS_FINAL final #define HS_FINAL_OVERRIDE override final // Prefer both to satisfy -Wsuggest-override -#define HS_NOEXCEPT noexcept +#if defined(_MSC_VER) && (_MSC_VER < 1900) +# define HS_NOEXCEPT throw() +# define HS_CONSTEXPR const +#else +# define HS_NOEXCEPT noexcept +# define HS_CONSTEXPR constexpr +#endif enum CallbackEvent { @@ -85,7 +91,7 @@ enum ControlEventCode }; template -constexpr size_t hsArraySize(T (&)[Size]) +HS_CONSTEXPR size_t hsArraySize(T(&)[Size]) { return Size; }