folly, tao: don't impose C constraints on folly's Portability.h
[folly.git] / folly / Portability.h
index 6d5ab9c938793b04d640862328fa986b59324cf6..1bec1699f6403b56b24a7a2d21ffc50bbdcd23bd 100644 (file)
@@ -25,6 +25,7 @@
 #include <features.h>
 #endif
 
+#include "CPortability.h"
 
 #if FOLLY_HAVE_SCHED_H
  #include <sched.h>
@@ -84,40 +85,6 @@ struct MaxAlign { char c; } __attribute__((aligned));
 # endif
 #endif
 
-
-/* Define a convenience macro to test when address sanitizer is being used
- * across the different compilers (e.g. clang, gcc) */
-#if defined(__clang__)
-# if __has_feature(address_sanitizer)
-#  define FOLLY_SANITIZE_ADDRESS 1
-# endif
-#elif defined (__GNUC__) && \
-      (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ >= 5)) && \
-      __SANITIZE_ADDRESS__
-# define FOLLY_SANITIZE_ADDRESS 1
-#endif
-
-/* Define attribute wrapper for function attribute used to disable
- * address sanitizer instrumentation. Unfortunately, this attribute
- * has issues when inlining is used, so disable that as well. */
-#ifdef FOLLY_SANITIZE_ADDRESS
-# if defined(__clang__)
-#  if __has_attribute(__no_address_safety_analysis__)
-#   define FOLLY_DISABLE_ADDRESS_SANITIZER \
-      __attribute__((__no_address_safety_analysis__, __noinline__))
-#  elif __has_attribute(__no_sanitize_address__)
-#   define FOLLY_DISABLE_ADDRESS_SANITIZER \
-      __attribute__((__no_sanitize_address__, __noinline__))
-#  endif
-# elif defined(__GNUC__)
-#  define FOLLY_DISABLE_ADDRESS_SANITIZER \
-     __attribute__((__no_address_safety_analysis__, __noinline__))
-# endif
-#endif
-#ifndef FOLLY_DISABLE_ADDRESS_SANITIZER
-# define FOLLY_DISABLE_ADDRESS_SANITIZER
-#endif
-
 // It turns out that GNU libstdc++ and LLVM libc++ differ on how they implement
 // the 'std' namespace; the latter uses inline namepsaces. Wrap this decision
 // up in a macro to make forward-declarations easier.