From: khizmax Date: Thu, 29 Sep 2016 20:35:53 +0000 (+0300) Subject: Fixed Clang 3.7 + libc++ issues X-Git-Tag: v2.2.0~106 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=d471a041345d2dea8dc2fc0a11cd051a82db806b Fixed Clang 3.7 + libc++ issues --- diff --git a/cds/algo/atomic.h b/cds/algo/atomic.h index a30737aa..f0e50f9c 100644 --- a/cds/algo/atomic.h +++ b/cds/algo/atomic.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSLIB_CXX11_ATOMIC_H diff --git a/cds/compiler/clang/defs.h b/cds/compiler/clang/defs.h index 8d701051..6d951228 100644 --- a/cds/compiler/clang/defs.h +++ b/cds/compiler/clang/defs.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -48,7 +48,7 @@ # error "Compiler version error. Clang version 3.3.0 and above is supported" #endif -#if defined(_LIBCPP_VERSION) && !defined(CDS_USE_BOOST_ATOMIC) +#if defined(_LIBCPP_VERSION) && !defined(CDS_USE_BOOST_ATOMIC) && CDS_COMPILER_VERSION < 30700 // Note: Clang libc++ atomic leads to program crash. // So, we use libcds atomic implementation # define CDS_USE_LIBCDS_ATOMIC diff --git a/cds/compiler/cxx11_atomic.h b/cds/compiler/cxx11_atomic.h index e0fcba6a..bdaf5260 100644 --- a/cds/compiler/cxx11_atomic.h +++ b/cds/compiler/cxx11_atomic.h @@ -114,6 +114,13 @@ namespace cds { namespace cxx11_atomic { { typedef std::uint64_t type; }; +#if CDS_BUILD_BITS == 64 && CDS_DCAS_SUPPORT + template <> + struct primary_type<16> + { + typedef unsigned __int128_t type; + }; +#endif template struct make_atomic_primary diff --git a/cds/container/striped_map/std_map.h b/cds/container/striped_map/std_map.h index 76da98bb..b1693c88 100644 --- a/cds/container/striped_map/std_map.h +++ b/cds/container/striped_map/std_map.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSLIB_CONTAINER_STRIPED_MAP_STD_MAP_ADAPTER_H diff --git a/cds/intrusive/mspriority_queue.h b/cds/intrusive/mspriority_queue.h index 7b8476e4..5b43b465 100644 --- a/cds/intrusive/mspriority_queue.h +++ b/cds/intrusive/mspriority_queue.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/projects/Win/vc14/stress-pqueue.vcxproj.filters b/projects/Win/vc14/stress-pqueue.vcxproj.filters index aa96454b..8ad0b704 100644 --- a/projects/Win/vc14/stress-pqueue.vcxproj.filters +++ b/projects/Win/vc14/stress-pqueue.vcxproj.filters @@ -9,10 +9,6 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - diff --git a/test/stress/map/map_type.h b/test/stress/map/map_type.h index f5c996f5..d0d03bf1 100644 --- a/test/stress/map/map_type.h +++ b/test/stress/map/map_type.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_MAP_TYPE_H @@ -73,7 +73,7 @@ namespace map { template struct hash; -#define CDSUNIT_INT_COMPARE(t) template <> struct cmp { int operator()( t k1, t k2 ){ return (int)(k1 - k2); } } +#define CDSUNIT_INT_COMPARE(t) template <> struct cmp { int operator()( t k1, t k2 ) const { return (int)(k1 - k2); } } CDSUNIT_INT_COMPARE(char); CDSUNIT_INT_COMPARE(unsigned char); CDSUNIT_INT_COMPARE(int); @@ -84,7 +84,7 @@ namespace map { CDSUNIT_INT_COMPARE(unsigned long long); #undef CDSUNIT_INT_COMPARE -#define CDSUNIT_INT_LESS(t) template <> struct less { bool operator()( t k1, t k2 ){ return k1 < k2; } } +#define CDSUNIT_INT_LESS(t) template <> struct less { bool operator()( t k1, t k2 ) const { return k1 < k2; } } CDSUNIT_INT_LESS( char ); CDSUNIT_INT_LESS( unsigned char ); CDSUNIT_INT_LESS( int ); diff --git a/test/stress/pqueue/item.h b/test/stress/pqueue/item.h index 1a14fba1..0d062768 100644 --- a/test/stress/pqueue/item.h +++ b/test/stress/pqueue/item.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSSTRESS_PQUEUE_ITEM_H @@ -52,61 +52,33 @@ namespace pqueue { simple_value( key_type n ) : key(n) {} - }; -} // namespace pqueue -namespace std { - template struct less; - template struct greater; - - template <> - struct less - { - bool operator()( pqueue::simple_value const& k1, pqueue::simple_value const& k2 ) const + friend bool operator <( simple_value const& lhs, simple_value const& rhs ) { - return k1.key < k2.key; + return lhs.key < rhs.key; } - - bool operator()( pqueue::simple_value const& k1, size_t k2 ) const + friend bool operator <( simple_value const& lhs, size_t rhs ) { - return k1.key < k2; + return lhs.key < rhs; } - - bool operator()( size_t k1, pqueue::simple_value const& k2 ) const + friend bool operator <( size_t lhs, simple_value const& rhs ) { - return k1 < k2.key; + return lhs < rhs.key; } - bool operator()( size_t k1, size_t k2 ) const + friend bool operator >( simple_value const& lhs, simple_value const& rhs ) { - return k1 < k2; + return lhs.key > rhs.key; } - }; - - template <> - struct greater - { - bool operator()( pqueue::simple_value const& k1, pqueue::simple_value const& k2 ) const + friend bool operator >( simple_value const& lhs, size_t rhs ) { - return k1.key > k2.key; + return lhs.key > rhs; } - - bool operator()( pqueue::simple_value const& k1, size_t k2 ) const + friend bool operator >( size_t lhs, simple_value const& rhs ) { - return k1.key > k2; - } - - bool operator()( size_t k1, pqueue::simple_value const& k2 ) const - { - return k1 > k2.key; - } - - bool operator()( size_t k1, size_t k2 ) const - { - return k1 > k2; + return lhs > rhs.key; } }; - -} // namespace std +} // namespace pqueue #endif // #ifndef CDSSTRESS_PQUEUE_ITEM_H diff --git a/test/stress/pqueue/pqueue_type.h b/test/stress/pqueue/pqueue_type.h index 2728fa28..ce304665 100644 --- a/test/stress/pqueue/pqueue_type.h +++ b/test/stress/pqueue/pqueue_type.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/test/unit/misc/cxx11_atomic_class.cpp b/test/unit/misc/cxx11_atomic_class.cpp index 7003e704..cc5c871e 100644 --- a/test/unit/misc/cxx11_atomic_class.cpp +++ b/test/unit/misc/cxx11_atomic_class.cpp @@ -788,7 +788,8 @@ namespace { test_atomic_integral_volatile(); } -#if CDS_COMPILER != CDS_COMPILER_CLANG || defined(_LIBCPP_VERSION) +#if !( CDS_COMPILER == CDS_COMPILER_CLANG && defined(_LIBCPP_VERSION) && CDS_COMPILER_VERSION < 30800 ) + //clang error (libc++) with atomic fetch_add/fetch_sub TEST_F( cxx11_atomic_class, atomic_pointer_void ) { do_test_atomic_pointer_void(); diff --git a/test/unit/misc/cxx11_atomic_func.cpp b/test/unit/misc/cxx11_atomic_func.cpp index 8426ff9b..98f2ef85 100644 --- a/test/unit/misc/cxx11_atomic_func.cpp +++ b/test/unit/misc/cxx11_atomic_func.cpp @@ -706,7 +706,8 @@ namespace misc { test_atomic_integral_volatile(); } -#if CDS_COMPILER != CDS_COMPILER_CLANG || defined(_LIBCPP_VERSION) +#if !( CDS_COMPILER == CDS_COMPILER_CLANG && defined(_LIBCPP_VERSION) && CDS_COMPILER_VERSION < 30800 ) + //clang error (libc++) with atomic fetch_add/fetch_sub TEST_F( cxx11_atomic_func, atomic_pointer_void ) { do_test_atomic_pointer_void();