if(WITH_ASAN)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fPIC -fsanitize=address,undefined -g -DCDS_ASAN_ENABLED -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fPIC -fsanitize=address,undefined -g -DCDS_ADDRESS_SANITIZER_ENABLED -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O1 -fsanitize=address,undefined -g -DCDS_ASAN_ENABLED -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined -pie")
else()
# define CDS_THREAD_SANITIZER_ENABLED
#endif
+#if defined(__has_feature) && __has_feature(address_sanitizer)
+# ifndef CDS_ADDRESS_SANITIZER_ENABLED
+# define CDS_ADDRESS_SANITIZER_ENABLED
+# endif
+#endif
+
+
// *************************************************
// Alignment macro
# endif
#endif
+// Sanitizer attributes
+// Example: CDS_DISABLE_SANITIZE( "function" )
+#ifdef CDS_ADDRESS_SANITIZER_ENABLED
+# define CDS_SUPPRESS_SANITIZE( ... ) __attribute__(( no_sanitize( __VA_ARGS__ ) ))
+#else
+# define CDS_SUPPRESS_SANITIZE( ... )
+#endif
+
#endif // #ifndef CDSLIB_COMPILER_GCC_COMPILER_MACRO_H
# endif
#endif
+
#include <cds/compiler/gcc/compiler_barriers.h>
#endif // #ifndef CDSLIB_COMPILER_GCC_DEFS_H
# endif
#endif
+// Sanitizer attributes (not supported)
+#define CDS_SUPPRESS_SANITIZE( ... )
+
#include <cds/compiler/icl/compiler_barriers.h>
//@endcond
# define CDS_ARCH_LITTLE_ENDIAN
#endif
+// Sanitizer attributes (not supported)
+#define CDS_SUPPRESS_SANITIZE( ... )
+
#include <cds/compiler/vc/compiler_barriers.h>
//@endcond
}
/// Invokes destructor function for the pointer
- void free()
+ void free() CDS_SUPPRESS_SANITIZE( "function" )
{
assert( m_funcFree );
assert( m_p );
CDS_NOEXCEPT=noexcept() \
CDS_CONSTEXPR=constexpr \
CDS_CXX11_INHERITING_CTOR \
- CDS_EXCEPTION_ENABLED
+ CDS_EXCEPTION_ENABLED \
+ CDS_SUPPRESS_SANITIZE
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifdef CDS_ASAN_ENABLED
+#ifdef CDS_ADDRESS_SANITIZER_ENABLED
#include <gtest/gtest.h>
}
} // namespace
-#endif // #ifdef CDS_ASAN_ENABLED
+#endif // #ifdef CDS_ADDRESS_SANITIZER_ENABLED