Merge branch 'ldionne-ldionne-cmake' into dev
[libcds.git] / cds / details / defs.h
index b1f0331c7c4c84c54ffe1a1b66693e440fae8822..e78fc762b165a778bec8a858bec41d25984beece 100644 (file)
@@ -32,6 +32,7 @@
 #define CDSLIB_DEFS_H
 
 #include <stddef.h>
+#include <stdlib.h>
 #include <assert.h>
 #include <cstdint>
 #include <exception>
    - \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 <b>cds</b> library and test suite you need:
@@ -354,6 +364,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 <cds/compiler/defs.h>