folly: fix clang's -Wundefined-var-template
[folly.git] / folly / CPortability.h
index febf2a141be07266d06f19e648cbbe83e3e9e639..37d97382e56b5d5d88e3759ce645a5d191c34e93 100644 (file)
 # define FOLLY_DISABLE_ADDRESS_SANITIZER
 #endif
 
+/* Define a convenience macro to test when thread sanitizer is being used
+ * across the different compilers (e.g. clang, gcc) */
+#if defined(__clang__)
+# if __has_feature(thread_sanitizer)
+#  define FOLLY_SANITIZE_THREAD 1
+# endif
+#elif defined(__GNUC__) && __SANITIZE_THREAD__
+# define FOLLY_SANITIZE_THREAD 1
+#endif
 
 /**
  * ASAN/MSAN/TSAN define pre-processor symbols: