X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=cds%2Fdetails%2Fdefs.h;h=4d382aeae1c8ddae3aeca13fac489f4f18cde21f;hp=3e4d53fbcf3ad955ec10ed7124d2097bbb44d4a2;hb=5fc87a172bd82f8a7040b8b83f32ce0e635e82ea;hpb=109dabde47396bc0d73d67c635b808ec8f8efbae diff --git a/cds/details/defs.h b/cds/details/defs.h index 3e4d53fb..4d382aea 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -1,7 +1,7 @@ /* This file is a part of libcds - Concurrent Data Structures library - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ @@ -32,6 +32,7 @@ #define CDSLIB_DEFS_H #include +#include #include #include #include @@ -162,12 +163,21 @@ \par How to build The cds is mostly header-only library. Only small part of library related to GC core functionality - should be compiled. + should be compiled. cds depends on C++ standard library only. - External dependenies: the tests depends on: + Test suite depends on: - \p boost.thread (thread-loal storage support), boost.system - \p google-test + Some parts of libcds may depend on DCAS (double-width compare-and-swap) atomic primitive if + the target architecture supports it. For x86, cmake build script enables -mcx16 compiler flag that + switches DCAS support on. You may manually disable DCAS support with the following command line flags + in GCC/clang (for MS VC++ compiler DCAS is not supported): + - \p -DCDS_DISABLE_128BIT_ATOMIC - for 64bit build + - \p -DCDS_DISABLE_64BIT_ATOMIC - for 32bit build + + @warning All your projects AND libcds MUST be compiled with the same flags - either with DCAS support or without it. + \par Windows build Prerequisites: for building cds library and test suite you need: @@ -176,7 +186,7 @@ - boost library 1.51 and above. You should create environment variable \p BOOST_PATH containing full path to \p boost root directory (for example, C:\\libs\\boost_1_57_0). - Open solution file cds\projects\vc14\cds.sln with Microsoft VisualStudio 2015. + Open solution file cds\projects\vc141\cds.sln with Microsoft VisualStudio 2017. The solution contains \p cds project and a lot of test projects. Just build the library using solution. Warning: the solution depends on \p BOOST_PATH environment variable that specifies full path @@ -196,10 +206,6 @@ For Unix-like systems GCC and Clang compilers are supported. Use GCC 4.8+ compiler or Clang 3.6+ to build cds library with CMake. See accompanying file /build/cmake/readme.md for more info. - - @note Important for GCC compiler: all your projects that use \p libcds must be compiled with -fno-strict-aliasing - compiler flag. - */ @@ -339,11 +345,15 @@ namespace cds {} // CDS_VERIFY: Debug - assert(_expr); Release - _expr #ifdef CDS_DEBUG -# define CDS_VERIFY( _expr ) assert( _expr ) +# define CDS_VERIFY( _expr ) assert( _expr ) +# define CDS_VERIFY_FALSE( _expr ) assert( !( _expr )) # define CDS_DEBUG_ONLY( _expr ) _expr +# define CDS_VERIFY_EQ( expr, val ) assert( expr == val ) #else # define CDS_VERIFY( _expr ) _expr +# define CDS_VERIFY_FALSE( _expr ) _expr # define CDS_DEBUG_ONLY( _expr ) +# define CDS_VERIFY_EQ( expr, val ) expr #endif #ifdef CDS_STRICT @@ -352,6 +362,14 @@ namespace cds {} # define CDS_STRICT_DO( _expr ) #endif +#ifdef CDS_DEBUG +# define cds_assert( expr ) assert( expr ) +#else + static inline void cds_assert( bool expr ) { + if ( !expr ) + abort(); + } +#endif // Compiler-specific defines #include