From e7f575e9d0b2dd4bb8b3606226394233395e0f14 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 2 Nov 2014 17:00:04 +0300 Subject: [PATCH] Fix Intel C++ compiler incompatibility --- cds/intrusive/striped_set/boost_avl_set.h | 2 +- tests/test-hdr/misc/cxx11_atomic_class.cpp | 37 ++----------------- tests/test-hdr/misc/cxx11_atomic_func.cpp | 35 ++---------------- .../misc/cxx11_convert_memory_order.h | 12 ++++++ 4 files changed, 21 insertions(+), 65 deletions(-) diff --git a/cds/intrusive/striped_set/boost_avl_set.h b/cds/intrusive/striped_set/boost_avl_set.h index b83aea46..0fdc31ab 100644 --- a/cds/intrusive/striped_set/boost_avl_set.h +++ b/cds/intrusive/striped_set/boost_avl_set.h @@ -14,7 +14,7 @@ namespace cds { namespace intrusive { namespace striped_set { class adapt< boost::intrusive::avl_set< T, P1, P2, P3, P4, P5 >, Options... > { public: - typedef boost::intrusive::avl_set< T > container_type; ///< underlying intrusive container type + typedef boost::intrusive::avl_set< T, P1, P2, P3, P4, P5 > container_type; ///< underlying intrusive container type public: typedef details::boost_intrusive_set_adapter type; ///< Result of the metafunction diff --git a/tests/test-hdr/misc/cxx11_atomic_class.cpp b/tests/test-hdr/misc/cxx11_atomic_class.cpp index 7637b72c..cafd6a62 100644 --- a/tests/test-hdr/misc/cxx11_atomic_class.cpp +++ b/tests/test-hdr/misc/cxx11_atomic_class.cpp @@ -365,15 +365,16 @@ namespace misc { { const atomics::memory_order oLoad = convert_to_load_order( order ); const atomics::memory_order oStore = convert_to_store_order( order ); + const atomics::memory_order oExchange = convert_to_exchange_order( order ); CPPUNIT_ASSERT( a.is_lock_free() ); a.store( false, oStore ); CPPUNIT_ASSERT( a == false ); CPPUNIT_ASSERT( a.load( oLoad ) == false ); - CPPUNIT_ASSERT( a.exchange( true, order ) == false ); + CPPUNIT_ASSERT( a.exchange( true, oExchange ) == false ); CPPUNIT_ASSERT( a.load( oLoad ) == true ); - CPPUNIT_ASSERT( a.exchange( false, order ) == true ); + CPPUNIT_ASSERT( a.exchange( false, oExchange ) == true ); CPPUNIT_ASSERT( a.load( oLoad ) == false ); bool expected = false; @@ -394,7 +395,7 @@ namespace misc { CPPUNIT_ASSERT( a.load( oLoad ) == true ); - CPPUNIT_ASSERT( a.exchange( false, order ) == true ); + CPPUNIT_ASSERT( a.exchange( false, oExchange ) == true ); } @@ -667,16 +668,6 @@ namespace misc { void test_atomic_unsigned_long() { test_atomic_integral(); } void test_atomic_long_long() { test_atomic_integral(); } void test_atomic_unsigned_long_long() { test_atomic_integral(); } -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// void test_atomic_char16_t() { test_atomic_integral(); } -// void test_atomic_char32_t() { test_atomic_integral(); } -//#endif -// void test_atomic_wchar_t() -// { -//#if CDS_OS_TYPE != CDS_OS_HPUX -// test_atomic_integral(); -//#endif -// } void test_atomic_char_volatile() { test_atomic_integral_volatile(); } void test_atomic_signed_char_volatile() { test_atomic_integral_volatile(); } @@ -689,16 +680,6 @@ namespace misc { void test_atomic_unsigned_long_volatile() { test_atomic_integral_volatile(); } void test_atomic_long_long_volatile() { test_atomic_integral_volatile(); } void test_atomic_unsigned_long_long_volatile() { test_atomic_integral_volatile(); } -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// void test_atomic_char16_t_volatile() { test_atomic_integral_volatile(); } -// void test_atomic_char32_t_volatile() { test_atomic_integral_volatile(); } -//#endif -// void test_atomic_wchar_t_volatile() -// { -//#if CDS_OS_TYPE != CDS_OS_HPUX -// test_atomic_integral_volatile(); -//#endif -// } void test_atomic_pointer_void() { do_test_atomic_pointer_void() ;} void test_atomic_pointer_void_volatile(){ do_test_atomic_pointer_void() ;} @@ -732,11 +713,6 @@ namespace misc { CPPUNIT_TEST( test_atomic_unsigned_long) CPPUNIT_TEST( test_atomic_long_long) CPPUNIT_TEST( test_atomic_unsigned_long_long) -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// CPPUNIT_TEST( test_atomic_char16_t ) -// CPPUNIT_TEST( test_atomic_char32_t ) -//#endif -// CPPUNIT_TEST( test_atomic_wchar_t) CPPUNIT_TEST( test_atomic_bool_volatile ) CPPUNIT_TEST( test_atomic_char_volatile ) @@ -750,11 +726,6 @@ namespace misc { CPPUNIT_TEST( test_atomic_unsigned_long_volatile) CPPUNIT_TEST( test_atomic_long_long_volatile) CPPUNIT_TEST( test_atomic_unsigned_long_long_volatile) -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// CPPUNIT_TEST( test_atomic_char16_t_volatile ) -// CPPUNIT_TEST( test_atomic_char32_t_volatile ) -//#endif -// CPPUNIT_TEST( test_atomic_wchar_t_volatile) CPPUNIT_TEST( test_atomic_pointer_void) CPPUNIT_TEST( test_atomic_pointer_void_volatile) diff --git a/tests/test-hdr/misc/cxx11_atomic_func.cpp b/tests/test-hdr/misc/cxx11_atomic_func.cpp index 724670e3..d5f7f2f9 100644 --- a/tests/test-hdr/misc/cxx11_atomic_func.cpp +++ b/tests/test-hdr/misc/cxx11_atomic_func.cpp @@ -333,15 +333,16 @@ namespace misc { { const atomics::memory_order oLoad = convert_to_load_order( order ); const atomics::memory_order oStore = convert_to_store_order( order ); + const atomics::memory_order oExchange = convert_to_exchange_order( order ); CPPUNIT_ASSERT( atomics::atomic_is_lock_free( &a ) ); atomics::atomic_store_explicit( &a, false, oStore ); CPPUNIT_ASSERT( a == false ); CPPUNIT_ASSERT( atomics::atomic_load_explicit( &a, oLoad ) == false ); - CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, true, order ) == false ); + CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, true, oExchange ) == false ); CPPUNIT_ASSERT( atomics::atomic_load_explicit( &a, oLoad ) == true ); - CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, false, order ) == true ); + CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, false, oExchange ) == true ); CPPUNIT_ASSERT( atomics::atomic_load_explicit( &a, oLoad ) == false ); bool expected = false; @@ -361,7 +362,7 @@ namespace misc { CPPUNIT_ASSERT( atomics::atomic_load_explicit( &a, oLoad ) == true ); - CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, false, order ) == true ); + CPPUNIT_ASSERT( atomics::atomic_exchange_explicit( &a, false, oExchange ) == true ); } template @@ -620,24 +621,6 @@ namespace misc { void test_atomic_long_long_volatile() { test_atomic_integral_volatile(); } void test_atomic_unsigned_long_long() { test_atomic_integral(); } void test_atomic_unsigned_long_long_volatile() { test_atomic_integral_volatile(); } -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// void test_atomic_char16_t() { test_atomic_integral(); } -// void test_atomic_char16_t_volatile() { test_atomic_integral_volatile(); } -// void test_atomic_char32_t() { test_atomic_integral(); } -// void test_atomic_char32_t_volatile() { test_atomic_integral_volatile(); } -//#endif -// void test_atomic_wchar_t() -// { -//#if CDS_OS_TYPE != CDS_OS_HPUX -// test_atomic_integral(); -//#endif -// } -// void test_atomic_wchar_t_volatile() -// { -//#if CDS_OS_TYPE != CDS_OS_HPUX -// test_atomic_integral_volatile(); -//#endif -// } void test_atomic_pointer_void() { do_test_atomic_pointer_void() ;} void test_atomic_pointer_void_volatile(){ do_test_atomic_pointer_void() ;} @@ -688,11 +671,6 @@ namespace misc { CPPUNIT_TEST( test_atomic_unsigned_long) CPPUNIT_TEST( test_atomic_long_long) CPPUNIT_TEST( test_atomic_unsigned_long_long) -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// CPPUNIT_TEST( test_atomic_char16_t ) -// CPPUNIT_TEST( test_atomic_char32_t ) -//#endif -// CPPUNIT_TEST( test_atomic_wchar_t) CPPUNIT_TEST( test_atomic_bool_volatile ) CPPUNIT_TEST( test_atomic_char_volatile ) @@ -706,11 +684,6 @@ namespace misc { CPPUNIT_TEST( test_atomic_unsigned_long_volatile) CPPUNIT_TEST( test_atomic_long_long_volatile) CPPUNIT_TEST( test_atomic_unsigned_long_long_volatile) -//#if CDS_COMPILER == CDS_COMPILER_GCC && CDS_COMPILER_VERSION >= 40400 -// CPPUNIT_TEST( test_atomic_char16_t_volatile ) -// CPPUNIT_TEST( test_atomic_char32_t_volatile ) -//#endif -// CPPUNIT_TEST( test_atomic_wchar_t_volatile) CPPUNIT_TEST( test_atomic_pointer_void) CPPUNIT_TEST( test_atomic_pointer_void_volatile) diff --git a/tests/test-hdr/misc/cxx11_convert_memory_order.h b/tests/test-hdr/misc/cxx11_convert_memory_order.h index cf6be725..a9dfc243 100644 --- a/tests/test-hdr/misc/cxx11_convert_memory_order.h +++ b/tests/test-hdr/misc/cxx11_convert_memory_order.h @@ -29,6 +29,18 @@ namespace misc { } } +#if CDS_COMPILER == CDS_COMPILER_INTEL + static inline atomics::memory_order convert_to_exchange_order( atomics::memory_order order ) + { + return order == atomics::memory_order_consume ? atomics::memory_order_relaxed : order; + } +#else + static inline atomics::memory_order convert_to_exchange_order( atomics::memory_order order ) + { + return order; + } +#endif + template struct add_volatile; -- 2.34.1