From 343dfae78659ce578a8d7391e468fef14e0b2b92 Mon Sep 17 00:00:00 2001 From: "Zezheng.Li" Date: Tue, 1 Aug 2023 13:40:17 +0800 Subject: [PATCH] fix --- cmake/build.cmake | 4 +++- cmake/platform.cmake | 17 ----------------- include/ylt/struct_pack/struct_pack_impl.hpp | 8 ++++---- 3 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 cmake/platform.cmake diff --git a/cmake/build.cmake b/cmake/build.cmake index 8533a85ab1..4e81f1119c 100644 --- a/cmake/build.cmake +++ b/cmake/build.cmake @@ -55,7 +55,9 @@ endif () # --------------------- GCC if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines") + if (ENABLE_CPP_20) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines") + endif() #-ftree-slp-vectorize with coroutine cause link error. disable it util gcc fix. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize") endif() diff --git a/cmake/platform.cmake b/cmake/platform.cmake deleted file mode 100644 index cd18cd9528..0000000000 --- a/cmake/platform.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# --------------------- Gcc -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if (ENABLE_CPP_20) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcoroutines") - endif() - #-ftree-slp-vectorize with coroutine cause link error. disable it util gcc fix. - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize") -endif() -# --------------------- Clang - -# --------------------- Msvc -# Resolves C1128 complained by MSVC: number of sections exceeded object file format limit: compile with /bigobj. -add_compile_options("$<$:/bigobj>") -# Resolves C4737 complained by MSVC: C4737: Unable to perform required tail call. Performance may be degraded. "Release-Type only" -if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") -add_compile_options("$<$:/EHa>") -endif() \ No newline at end of file diff --git a/include/ylt/struct_pack/struct_pack_impl.hpp b/include/ylt/struct_pack/struct_pack_impl.hpp index d4ef84d6c6..838c88e0d4 100644 --- a/include/ylt/struct_pack/struct_pack_impl.hpp +++ b/include/ylt/struct_pack/struct_pack_impl.hpp @@ -671,7 +671,7 @@ constexpr std::size_t check_circle_impl(std::index_sequence) { template constexpr std::size_t check_circle() { - if constexpr (sizeof...(ParentArgs)) { + if constexpr (sizeof...(ParentArgs) != 0) { return check_circle_impl( std::make_index_sequence()); } @@ -2079,7 +2079,7 @@ class unpacker { } constexpr std::size_t sz = compatible_version_number.size(); err_code = deserialize_compatibles( - t, args..., std::make_index_sequence{}); + t, std::make_index_sequence{}, args...); } return err_code; } @@ -2131,7 +2131,7 @@ class unpacker { } constexpr std::size_t sz = compatible_version_number.size(); err_code = deserialize_compatibles( - t, args..., std::make_index_sequence{}); + t, std::make_index_sequence{}, args...); } return err_code; } @@ -2193,7 +2193,7 @@ class unpacker { private: template STRUCT_PACK_INLINE struct_pack::errc deserialize_compatibles( - T &t, Args &...args, std::index_sequence) { + T &t, std::index_sequence, Args &...args) { using Type = get_args_type; struct_pack::errc err_code; switch (size_type_) {