From 0dcfe576d30339322d7d83b114d33f92522185ab Mon Sep 17 00:00:00 2001 From: wermos <63574588+wermos@users.noreply.github.com> Date: Sun, 12 Mar 2023 08:07:01 +0530 Subject: [PATCH 1/3] Specificed the project language and minimum C++ version. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 995ce0a..1f26c2c 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 14) option(BUILD_TESTING "Build the testing tree." ON) From f30ef839ffe4ee15b5fbca9eb3742c0ccad9d9ad Mon Sep 17 00:00:00 2001 From: wermos <63574588+wermos@users.noreply.github.com> Date: Sun, 12 Mar 2023 08:07:31 +0530 Subject: [PATCH 2/3] Added a `[[maybe_unused]]` macro. --- Fastor/config/config.h | 14 +++++++++++++- Fastor/util/extended_algorithms.h | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) 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 From 83ab0b328dcada626b413f20f846b2fb2d546f23 Mon Sep 17 00:00:00 2001 From: wermos <63574588+wermos@users.noreply.github.com> Date: Sun, 12 Mar 2023 08:28:30 +0530 Subject: [PATCH 3/3] Set the C++ version to 17. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f26c2c..cdce011 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(fastor VERSION 0.6.4 LANGUAGES CXX) # specify the C++ standard -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) option(BUILD_TESTING "Build the testing tree." ON)