diff --git a/CMakeLists.txt b/CMakeLists.txt index 2aa95082b..fc04d0caa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,16 +53,12 @@ separate_arguments(OC_EXE_LINKER_FLAGS) set(OC_EXE_LINKER_FLAGS_DEBUG ${CMAKE_EXE_LINKER_FLAGS_DEBUG}) separate_arguments(OC_EXE_LINKER_FLAGS_DEBUG) -CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" USE_GCC_STD_0X) CHECK_CXX_COMPILER_FLAG("-std=gnu++14" USE_GCC_STD_14) if(USE_GCC_STD_14) if(OC_CXX_FLAGS MATCHES \\-std=gnu\\+\\+0x) - unset(HAVE_MAKE_UNIQUE CACHE) list(REMOVE_ITEM OC_CXX_FLAGS "-std=gnu++0x") endif() list(APPEND OC_CXX_FLAGS "-std=gnu++14") -elseif(USE_GCC_STD_0X) - list(APPEND OC_CXX_FLAGS "-std=gnu++0x") endif() if(MSVC_VERSION GREATER 1499) @@ -149,7 +145,8 @@ include(CheckCXXSymbolExists) REQUIRE_CXX_SOURCE_COMPILES("#include \nint main() { std::unique_ptr a; std::shared_ptr b; }" HAVE_C11_SMART_PTRS) REQUIRE_CXX_SOURCE_COMPILES("int main() { static_assert(true, \"\"); }" HAVE_STATIC_ASSERT) -CHECK_CXX_SOURCE_COMPILES("#include \nint main() { auto a = std::make_unique(0); }" HAVE_MAKE_UNIQUE) +REQUIRE_CXX_SOURCE_COMPILES("#include \nint main() { auto a = std::make_unique(0); return !!a; }" HAVE_MAKE_UNIQUE) +REQUIRE_CXX_SOURCE_COMPILES("#include \ntemplate int foo(std::index_sequence) {return 0;} int main() { return foo(std::index_sequence_for{}); }" HAVE_INDEX_SEQUENCE) REQUIRE_CXX_SOURCE_COMPILES("template class C; int main() { return 0; }" HAVE_VARIADIC_TEMPLATES) # g++'s libstdc++ doesn't properly support until 4.9. @@ -1046,8 +1043,7 @@ src/platform/StdSchedulerWin32.cpp src/platform/StdSchedulerPoll.cpp src/platform/StdScheduler.h src/platform/C4TimeMilliseconds.cpp -src/platform/C4TimeMilliseconds.h -src/platform/make_unique.h +src/platform/C4TimeMilliseconds.h src/zlib/gzio.c src/zlib/gzio.h src/zlib/zutil.h diff --git a/src/platform/PlatformAbstraction.h b/src/platform/PlatformAbstraction.h index df3e4b098..3785d6985 100644 --- a/src/platform/PlatformAbstraction.h +++ b/src/platform/PlatformAbstraction.h @@ -89,10 +89,6 @@ typedef ptrdiff_t ssize_t; #endif - -// std::make_unique -#include "platform/make_unique.h" - #if defined(__GNUC__) // Allow checks for correct printf-usage #define GNUC_FORMAT_ATTRIBUTE __attribute__ ((format (printf, 1, 2))) diff --git a/src/platform/make_unique.h b/src/platform/make_unique.h deleted file mode 100644 index f4293bf12..000000000 --- a/src/platform/make_unique.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * OpenClonk, http://www.openclonk.org - * - * Copyright (c) 2015, The OpenClonk Team and contributors - * - * Distributed under the terms of the ISC license; see accompanying file - * "COPYING" for details. - * - * "Clonk" is a registered trademark of Matthes Bender, used with permission. - * See accompanying file "TRADEMARK" for details. - * - * To redistribute this file separately, substitute the full license texts - * for the above references. - */ - -#ifndef INC_make_unique -#define INC_make_unique - -// C++14 std::make_unique -#include -#include -#ifndef HAVE_MAKE_UNIQUE -namespace detail { - -template -typename std::enable_if::value && std::extent::value == 0, std::unique_ptr>::type -make_unique(size_t n) -{ - return std::unique_ptr(new typename std::remove_extent::type[n]()); -} - -template -typename std::enable_if::value, std::unique_ptr>::type -make_unique(Args &&...args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -} -namespace std { using ::detail::make_unique; } -#endif - -#endif