Merge branch 'master' into dev
[libcds.git] / cds / details / defs.h
index 2d469d17fe3d9ae66632843df78caca801e06f90..e78fc762b165a778bec8a858bec41d25984beece 100644 (file)
@@ -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 <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:
    to \p boost library root directory. The test projects search \p boost libraries in:
    - for 32bit: <tt>\$(BOOST_PATH)/stage/lib</tt>, <tt>\$(BOOST_PATH)/stage32/lib</tt>, and <tt>\$(BOOST_PATH)/bin</tt>.
    - for 64bit: <tt>\$(BOOST_PATH)/stage64/lib</tt> and <tt>\$(BOOST_PATH)/bin</tt>.
-   
+
    All tests are based on googletest framework. The following environment variables specify
    where to find gtest include and library directories:
    - \p GTEST_ROOT - gtest root directory. <tt>\$(GTEST_ROOT)/include</tt> specifies full path to
@@ -237,6 +247,7 @@ namespace cds {}
                     - CDS_PROCESSOR_SPARC   Sparc
                     - CDS_PROCESSOR_PPC64   PowerPC64
                     - CDS_PROCESSOR_ARM7    ARM v7
+                    - CDS_PROCESSOR_ARM8    ARM v8
                     - CDS_PROCESSOR_UNKNOWN undefined processor architecture
 
     CDS_PROCESSOR__NAME    The name (string) of processor architecture
@@ -292,6 +303,7 @@ namespace cds {}
 #define CDS_PROCESSOR_AMD64     4
 #define CDS_PROCESSOR_PPC64     5   // PowerPC 64bit
 #define CDS_PROCESSOR_ARM7      7
+#define CDS_PROCESSOR_ARM8      8
 #define CDS_PROCESSOR_UNKNOWN   -1
 
 // Supported OS interfaces
@@ -337,10 +349,12 @@ 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
 #else
 #   define CDS_VERIFY( _expr )    _expr
+#   define CDS_VERIFY_FALSE( _expr ) _expr
 #   define CDS_DEBUG_ONLY( _expr )
 #endif
 
@@ -350,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>