From 8b04bbc248c953c90fb28ddce06f7673fb8c82df Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Mon, 13 Apr 2020 11:47:57 -0400 Subject: [PATCH 1/5] Mitigate around visual studio codegen bug --- include/kangaru/detail/define.hpp | 14 +++++++++++--- include/kangaru/detail/undef.hpp | 1 + include/kangaru/type_id.hpp | 25 ++++++++++++++++++------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/include/kangaru/detail/define.hpp b/include/kangaru/detail/define.hpp index a5abe8a0..792f9d4b 100644 --- a/include/kangaru/detail/define.hpp +++ b/include/kangaru/detail/define.hpp @@ -61,11 +61,19 @@ #endif // KGR_KANGARU_MSVC_EXACT_DECLTYPE #ifndef KGR_KANGARU_EMPTY_BASES -#if defined(_MSC_VER) +#ifdef _MSC_VER #define KGR_KANGARU_EMPTY_BASES __declspec(empty_bases) #else #define KGR_KANGARU_EMPTY_BASES -#endif -#endif +#endif // _MSC_VER +#endif // KGR_KANGARU_EMPTY_BASES + +#ifndef KGR_KANGARU_NONCONST_TYPEID +#ifdef _MSC_VER +#ifndef __clang__ +#define KGR_KANGARU_NONCONST_TYPEID +#endif // !__clang__ +#endif // _MSC_VER +#endif // KGR_KANGARU_NONCONST_TYPEID #endif // KGR_KANGARU_INCLUDE_KANGARU_DETAIL_DEFINE diff --git a/include/kangaru/detail/undef.hpp b/include/kangaru/detail/undef.hpp index 118d974f..4861ba8a 100644 --- a/include/kangaru/detail/undef.hpp +++ b/include/kangaru/detail/undef.hpp @@ -9,6 +9,7 @@ #undef KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD #undef KGR_KANGARU_MSVC_EXACT_DECLTYPE #undef KGR_KANGARU_EMPTY_BASES +#undef KGR_KANGARU_NONCONST_TYPEID // These two header are meant to be included // everytime they are needed since they cancel each other diff --git a/include/kangaru/type_id.hpp b/include/kangaru/type_id.hpp index 6ee24cfb..c71302a5 100644 --- a/include/kangaru/type_id.hpp +++ b/include/kangaru/type_id.hpp @@ -4,6 +4,8 @@ #include #include +#include "detail/define.hpp" + namespace kgr { namespace detail { @@ -29,7 +31,7 @@ struct is_index_storage> : std::true_type {}; * get it's pointer. We reuse that space to store meta information. */ struct type_id_data { - enum struct kind_t : std::uint8_t { normal, override_storage, index_storage } kind; + enum struct kind_t : std::uint8_t { normal, override_storage, index_storage } const kind; template static constexpr auto kind_for() noexcept -> type_id_data { @@ -48,13 +50,14 @@ struct type_id_data { */ template struct type_id_ptr { - struct id_t { - type_id_data data; - }; // Having a static data member will ensure us that it has only one address for the whole program. - // Furthermore, the static data member having different types will ensure it won't get optimized. - static constexpr id_t id = id_t{type_id_data::kind_for()}; + // Furthermore, the static data member all the same type will ensure it won't get optimized. +#ifdef KGR_KANGARU_NONCONST_TYPEID + static type_id_data id; +#else + static constexpr type_id_data id = type_id_data::kind_for(); +#endif }; /* @@ -67,8 +70,14 @@ struct type_id_ptr { * * Using the pointer of a static data member is more stable. */ + +#ifdef KGR_KANGARU_NONCONST_TYPEID template -constexpr typename type_id_ptr::id_t const type_id_ptr::id; +type_id_data type_id_ptr::id = type_id_data::kind_for(); +#else +template +constexpr type_id_data const type_id_ptr::id; +#endif inline constexpr auto type_id_kind(void const* id) -> type_id_data::kind_t { return static_cast(id)->kind; @@ -94,4 +103,6 @@ constexpr auto type_id() -> type_id_t { } // namespace kgr +#include "detail/undef.hpp" + #endif // KGR_KANGARU_INCLUDE_KANGARU_TYPE_ID_HPP From 225e7faaf0c5ab281f481fc150678d9be7b0b64f Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Tue, 5 May 2020 13:09:00 -0400 Subject: [PATCH 2/5] Bumped version number to 4.2.4 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72ca774b..ad74f966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 11) set(KANGARU_VERSION_MAJOR "4") set(KANGARU_VERSION_MINOR "2") -set(KANGARU_VERSION_PATCH "1") +set(KANGARU_VERSION_PATCH "4") set(KANGARU_VERSION "${KANGARU_VERSION_MAJOR}.${KANGARU_VERSION_MINOR}.${KANGARU_VERSION_PATCH}") From e7d07001316cf944093b12beeb60a387e081ac56 Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Tue, 5 May 2020 13:46:19 -0400 Subject: [PATCH 3/5] Enable bionic for clang 7 and 8 --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73b03e65..ea7bbcd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,19 +62,22 @@ matrix: addons: { apt: { packages: ["clang-6.0"], sources: ["ubuntu-toolchain-r-test"] } } - os: linux + dist: bionic env: - COMPILER=clang++-7 - LLVM_VERSION=7.0.0 - ENABLE_CXX14=true - ENABLE_CXX17=true - addons: { apt: { packages: ["clang-7"], sources: ["llvm-toolchain-trusty-7", "ubuntu-toolchain-r-test"] } } + addons: { apt: { packages: ["clang-7"], sources: ["ubuntu-toolchain-r-test"] } } + - os: linux + dist: bionic env: - COMPILER=clang++-8 - LLVM_VERSION=8.0.0 - ENABLE_CXX14=true - ENABLE_CXX17=true - addons: { apt: { packages: ["clang-8"], sources: ["llvm-toolchain-trusty-8", "ubuntu-toolchain-r-test"] } } + addons: { apt: { packages: ["clang-8"], sources: ["ubuntu-toolchain-r-test"] } } - os: linux env: From 1c7d3f9dbb596f227aaf87e8394271b955199748 Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Tue, 5 May 2020 13:49:20 -0400 Subject: [PATCH 4/5] Removed old OSX versions from CI --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea7bbcd1..8aa562e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -146,30 +146,6 @@ matrix: - ENABLE_CXX14=true - ENABLE_CXX17=true - - os: osx - osx_image: xcode9.2 - env: - - ENABLE_CXX14=true - - ENABLE_CXX17=true - - - os: osx - osx_image: xcode9.1 - env: - - ENABLE_CXX14=true - - ENABLE_CXX17=true - - - os: osx - osx_image: xcode9 - env: - - ENABLE_CXX14=true - - ENABLE_CXX17=true - - - os: osx - osx_image: xcode8.3 - env: - - ENABLE_CXX14=true - - ENABLE_CXX17=true - install: ############################################################################ # All the dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/ From 6b2a17eecc750e4961f5e85facef5d9a85cdffc8 Mon Sep 17 00:00:00 2001 From: Guillaume Racicot Date: Tue, 5 May 2020 14:12:55 -0400 Subject: [PATCH 5/5] Revert "Enable bionic for clang 7 and 8" This reverts commit e7d07001316cf944093b12beeb60a387e081ac56. --- .travis.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8aa562e9..68894a65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,22 +62,19 @@ matrix: addons: { apt: { packages: ["clang-6.0"], sources: ["ubuntu-toolchain-r-test"] } } - os: linux - dist: bionic env: - COMPILER=clang++-7 - LLVM_VERSION=7.0.0 - ENABLE_CXX14=true - ENABLE_CXX17=true - addons: { apt: { packages: ["clang-7"], sources: ["ubuntu-toolchain-r-test"] } } - + addons: { apt: { packages: ["clang-7"], sources: ["llvm-toolchain-trusty-7", "ubuntu-toolchain-r-test"] } } - os: linux - dist: bionic env: - COMPILER=clang++-8 - LLVM_VERSION=8.0.0 - ENABLE_CXX14=true - ENABLE_CXX17=true - addons: { apt: { packages: ["clang-8"], sources: ["ubuntu-toolchain-r-test"] } } + addons: { apt: { packages: ["clang-8"], sources: ["llvm-toolchain-trusty-8", "ubuntu-toolchain-r-test"] } } - os: linux env: