diff --git a/CMakeLists.txt b/CMakeLists.txt index 995ce0a..cdce011 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(fastor VERSION 0.6.4) +project(fastor VERSION 0.6.4 LANGUAGES CXX) + +# specify the C++ standard +set(CMAKE_CXX_STANDARD 17) option(BUILD_TESTING "Build the testing tree." ON) diff --git a/Fastor/config/config.h b/Fastor/config/config.h index c10b3e6..9b035fd 100644 --- a/Fastor/config/config.h +++ b/Fastor/config/config.h @@ -121,7 +121,7 @@ SOFTWARE. #define FASTOR_CXX_VERSION 2014 #elif __cplusplus == 201703L #define FASTOR_CXX_VERSION 2017 - #elif __cplusplus > 201703L + #elif __cplusplus > 202002L #define FASTOR_CXX_VERSION 2020 #endif #endif @@ -163,6 +163,18 @@ SOFTWARE. //------------------------------------------------------------------------------------------------// +// C++17 [[maybe_unused]] define +//------------------------------------------------------------------------------------------------// +#if FASTOR_CXX_VERSION >= 2017 + #define FASTOR_MAYBE_UNUSED [[maybe_unused]] +#elif defined(__GNUC__) || defined(__clang__) + #define FASTOR_MAYBE_UNUSED [[gnu::unused]] +#elif defined(_MSC_VER) +#define FASTOR_MAYBE_UNUSED __declspec(maybe_unused) +#endif +//------------------------------------------------------------------------------------------------// + + // Intrinsics defines //------------------------------------------------------------------------------------------------// diff --git a/Fastor/util/extended_algorithms.h b/Fastor/util/extended_algorithms.h index 8f8989c..9187de0 100644 --- a/Fastor/util/extended_algorithms.h +++ b/Fastor/util/extended_algorithms.h @@ -74,11 +74,11 @@ inline size_t set_stack_size(size_t size) { // Get sign of a number template -inline constexpr int signum(T x, [[gnu::unused]] std::false_type is_signed) { +inline constexpr int signum(T x, FASTOR_MAYBE_UNUSED std::false_type is_signed) { return T(0) < x; } template -inline constexpr int signum(T x, [[gnu::unused]] std::true_type is_signed) { +inline constexpr int signum(T x, FASTOR_MAYBE_UNUSED std::true_type is_signed) { return (T(0) < x) - (x < T(0)); } template