Commit e8887cf1 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

add FOLLY_SANITIZE_MEMORY macro

Summary: Similar to other sanitizer macros add one for memory sanitizer.

Reviewed By: pixelb

Differential Revision: D18662903

fbshipit-source-id: aa62dfedbfd1b174403af451e14ace9896b26466
parent 2501b652
...@@ -117,11 +117,29 @@ ...@@ -117,11 +117,29 @@
#endif #endif
/** /**
* Define a convenience macro to test when ASAN, UBSAN or TSAN sanitizer are * Define a convenience macro to test when memory sanitizer is being used
* being used * across the different compilers (e.g. clang, gcc)
*/
#ifndef FOLLY_SANITIZE_MEMORY
#if FOLLY_HAS_FEATURE(memory_sanitizer) || __SANITIZE_MEMORY__
#define FOLLY_SANITIZE_MEMORY 1
#endif
#endif
#if FOLLY_SANITIZE_MEMORY
#define FOLLY_DISABLE_MEMORY_SANITIZER \
__attribute__((no_sanitize_memory, noinline))
#else
#define FOLLY_DISABLE_MEMORY_SANITIZER
#endif
/**
* Define a convenience macro to test when ASAN, UBSAN, TSAN or MSAN sanitizer
* are being used
*/ */
#ifndef FOLLY_SANITIZE #ifndef FOLLY_SANITIZE
#if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD) #if defined(FOLLY_SANITIZE_ADDRESS) || defined(FOLLY_SANITIZE_THREAD) || \
defined(FOLLY_SANITIZE_MEMORY)
#define FOLLY_SANITIZE 1 #define FOLLY_SANITIZE 1
#endif #endif
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment