From af81a44dfd339424c3a9e796b1e0e3c0a34416ca Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 13 Nov 2016 21:13:30 +0300 Subject: [PATCH] Fixed tests and gcc incompatibilities --- cds/algo/split_bitstring.h | 5 +++-- cds/container/details/feldman_hashmap_base.h | 12 ++++++------ .../test_intrusive_feldman_hashset_rcu.h | 2 +- test/unit/misc/split_bitstring.cpp | 4 ++-- test/unit/set/test_feldman_hashset_rcu.h | 5 +++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/cds/algo/split_bitstring.h b/cds/algo/split_bitstring.h index f74d4ea7..d290ff77 100644 --- a/cds/algo/split_bitstring.h +++ b/cds/algo/split_bitstring.h @@ -46,7 +46,8 @@ namespace cds { namespace algo { Template parameters: - \p BitString - a fixed-sized type that interprets as bit string - - \p BitStringSize - the siZe of \p BitString in bytes, default is sizeof( BitString ) + - \p BitStringSize - the size of \p BitString in bytes, default is sizeof( BitString ). + You can specify 0 for default. - \p UInt - an unsigned integer, return type of \p cut() */ template ::type > @@ -55,7 +56,7 @@ namespace cds { namespace algo { public: typedef BitString bitstring; ///< Bit-string type typedef UInt uint_type; ///< Bit-string portion type - static CDS_CONSTEXPR size_t const c_bitstring_size = BitStringSize; ///< size of \p BitString in bytes + static CDS_CONSTEXPR size_t const c_bitstring_size = BitStringSize ? BitStringSize : sizeof( BitString ); ///< size of \p BitString in bytes //@cond static CDS_CONSTEXPR size_t const c_nHashSize = (c_bitstring_size + sizeof(uint_type) - 1) / sizeof(uint_type); diff --git a/cds/container/details/feldman_hashmap_base.h b/cds/container/details/feldman_hashmap_base.h index 9535cb5f..995414a2 100644 --- a/cds/container/details/feldman_hashmap_base.h +++ b/cds/container/details/feldman_hashmap_base.h @@ -275,20 +275,20 @@ namespace cds { namespace container { template node_type(hasher& h, Q const& key) - : m_Value(std::move(std::make_pair(key, mapped_type()))) - , m_hash(h(m_Value.first)) + : m_Value( std::move( std::make_pair( key_type( key ), mapped_type()))) + , m_hash( h( m_Value.first )) {} template node_type(hasher& h, Q const& key, U const& val) - : m_Value(std::move(std::make_pair(key, mapped_type(val)))) - , m_hash(h(m_Value.first)) + : m_Value( std::move( std::make_pair( key_type( key ), mapped_type(val)))) + , m_hash( h( m_Value.first )) {} template node_type(hasher& h, Q&& key, Args&&... args) - : m_Value(std::move(std::make_pair(std::forward(key), std::move(mapped_type(std::forward(args)...))))) - , m_hash(h(m_Value.first)) + : m_Value( std::move(std::make_pair( key_type( std::forward(key)), std::move( mapped_type(std::forward(args)...))))) + , m_hash( h( m_Value.first )) {} }; diff --git a/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h b/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h index 3f943632..6099a8e7 100644 --- a/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h +++ b/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h @@ -229,7 +229,7 @@ TYPED_TEST_P( IntrusiveFeldmanHashSet, explicit_hash_size ) { typedef typename TestFixture::hash_accessor2 hash_accessor; enum: size_t { - hash_size = sizeof( std::declval().nKey ) + hash_size = sizeof( std::declval().nKey ) }; typedef typename TestFixture::cmp2 compare; typedef typename TestFixture::mock_disposer disposer; diff --git a/test/unit/misc/split_bitstring.cpp b/test/unit/misc/split_bitstring.cpp index 27f7dc0c..69e5842c 100644 --- a/test/unit/misc/split_bitstring.cpp +++ b/test/unit/misc/split_bitstring.cpp @@ -195,7 +195,7 @@ namespace { { typedef PartUInt part_uint; - typedef cds::algo::split_bitstring< uint64_t, part_uint > split_bitstring; + typedef cds::algo::split_bitstring< uint64_t, 0, part_uint > split_bitstring; uint64_t src = 0xFEDCBA9876543210; split_bitstring splitter(src); @@ -250,7 +250,7 @@ namespace { { typedef PartUInt part_uint; - typedef cds::algo::split_bitstring< uint64_t, part_uint > split_bitstring; + typedef cds::algo::split_bitstring< uint64_t, 0, part_uint > split_bitstring; uint64_t src = 0xFEDCBA9876543210; split_bitstring splitter(src); diff --git a/test/unit/set/test_feldman_hashset_rcu.h b/test/unit/set/test_feldman_hashset_rcu.h index e7016fae..85b6161d 100644 --- a/test/unit/set/test_feldman_hashset_rcu.h +++ b/test/unit/set/test_feldman_hashset_rcu.h @@ -289,12 +289,13 @@ namespace { struct set_traits: public cc::feldman_hashset::traits { enum: size_t { - hash_size = sizeof( std::declval().nKey ) + hash_size = sizeof( std::declval().nKey ) }; typedef get_hash2 hash_accessor; + typedef typename TestFixture::cmp2 compare; typedef cc::feldman_hashset::stat<> stat; }; - typedef cc::FeldmanHashSet< rcu_type, int_item2, set_traits > set_type; + typedef cc::FeldmanHashSet< rcu_type, int_item, set_traits > set_type; set_type s( 8, 4 ); this->test( s ); -- 2.34.1