From 78e3457ff7b6e633d01d5afd04d3e851f00f7047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Sat, 23 Jan 2016 23:10:02 +0100 Subject: [PATCH] MSVC: Remove support and workarounds for versions older than 2015 We require that version for its C++14 support anyway. --- CMakeLists.txt | 24 +++++++----------------- src/C4Include.h | 8 -------- src/lib/C4Real.h | 16 ---------------- 3 files changed, 7 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 374bb88c3..68d0ffcd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,20 +59,18 @@ if(USE_GCC_STD_14) list(APPEND OC_CXX_FLAGS "-std=gnu++14") endif() -if(MSVC_VERSION GREATER 1499) +if(MSVC) list(APPEND OC_CXX_FLAGS /MP) list(REMOVE_ITEM OC_CXX_FLAGS_DEBUG /Gm) - if (NOT CMAKE_CL_64 OR NOT MSVC_VERSION VERSION_LESS 1900) - # Activate edit-and-continue - list(REMOVE_ITEM OC_CXX_FLAGS_DEBUG /Zi) - list(APPEND OC_CXX_FLAGS_DEBUG /ZI /Gy) - endif() + # Activate edit-and-continue + list(REMOVE_ITEM OC_CXX_FLAGS_DEBUG /Zi) + list(APPEND OC_CXX_FLAGS_DEBUG /ZI /Gy) + # do not link the release CRT in debug builds list(APPEND OC_EXE_LINKER_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRT") set(HAVE_PRECOMPILED_HEADERS ON CACHE INTERNAL "Compiler supports precompiled headers") -endif() -if(MSVC_VERSION) + # Suppress warnings about "non-secure" functions add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) # Disable warning C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data @@ -1217,7 +1215,7 @@ endif() # Precompiled header support for MSVC ############################################################################ if(HAVE_PRECOMPILED_HEADERS) - if(MSVC_VERSION) + if(MSVC) get_property(OC_SOURCES TARGET openclonk PROPERTY SOURCES) foreach(FILE ${OC_SOURCES}) get_filename_component(FILE_EXT ${FILE} EXT) @@ -1274,14 +1272,6 @@ add_subdirectory(tests) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) -# CMake support for MSVC 2010 is broken. Change the .sln file to avoid -# millions of "reload X project?" dialog boxes. -# For best results, also change CMake's ReloadProjects macro to only -# call StopBuild(). -if(MSVC_VERSION EQUAL 1600) - file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln" "\n# reload me\n") -endif() - # For MSVC 2015, add a Solution Items folder to the solution that contains # a reference to the debugger visualization file. if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015") diff --git a/src/C4Include.h b/src/C4Include.h index c4cbe0349..2845ce31a 100644 --- a/src/C4Include.h +++ b/src/C4Include.h @@ -70,17 +70,9 @@ namespace re = std; // because those libraries use placement new #ifndef NODEBUGMEM #if defined(_DEBUG) && defined(_MSC_VER) -#if _MSC_VER <= 1200 -#include -#include -#include -#include -#define malloc(size) ::_malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__) -#else #define _CRTDBG_MAP_ALLOC #include #include -#endif inline void *operator new(size_t s, const char *szFile, long iLine) { return ::operator new(s, _NORMAL_BLOCK, szFile, iLine); } inline void operator delete(void *p, const char *, long) diff --git a/src/lib/C4Real.h b/src/lib/C4Real.h index 8f6ac55e1..ebfc81d74 100644 --- a/src/lib/C4Real.h +++ b/src/lib/C4Real.h @@ -200,13 +200,6 @@ public: inline C4Fixed operator * (float iVal2) const { return C4Fixed(*this) *= iVal2; } inline C4Fixed operator / (float iVal2) const { return C4Fixed(*this) /= iVal2; } -#if defined(_MSC_VER) && _MSC_VER <= 1200 - inline C4Fixed operator + (int iVal2) const { return operator + (int32_t(iVal2)); } - inline C4Fixed operator - (int iVal2) const { return operator - (int32_t(iVal2)); } - inline C4Fixed operator * (int iVal2) const { return operator * (int32_t(iVal2)); } - inline C4Fixed operator / (int iVal2) const { return operator / (int32_t(iVal2)); } -#endif - inline bool operator == (int32_t iVal2) const { return operator == (C4Fixed(iVal2)); } inline bool operator < (int32_t iVal2) const { return operator < (C4Fixed(iVal2)); } inline bool operator > (int32_t iVal2) const { return operator > (C4Fixed(iVal2)); } @@ -221,15 +214,6 @@ public: inline bool operator >= (float iVal2) const { return operator >= (C4Fixed(iVal2)); } inline bool operator != (float iVal2) const { return operator != (C4Fixed(iVal2)); } -#if defined(_MSC_VER) && _MSC_VER <= 1200 - inline bool operator == (int iVal2) const { return operator == (C4Fixed(int32_t(iVal2))); } - inline bool operator < (int iVal2) const { return operator < (C4Fixed(int32_t(iVal2))); } - inline bool operator > (int iVal2) const { return operator > (C4Fixed(int32_t(iVal2))); } - inline bool operator <= (int iVal2) const { return operator <= (C4Fixed(int32_t(iVal2))); } - inline bool operator >= (int iVal2) const { return operator >= (C4Fixed(int32_t(iVal2))); } - inline bool operator != (int iVal2) const { return operator != (C4Fixed(int32_t(iVal2))); } -#endif - #ifdef C4REAL_USE_FIXNUM C4Fixed sin_deg() const {