From: Yedidya Feldblum Date: Fri, 31 Mar 2017 04:38:09 +0000 (-0700) Subject: Some constexpr symbols for whether sanitizers are enabled X-Git-Tag: v2017.04.03.00~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=388266e5f011284fa6ffb88c117bee39241fc763;p=folly.git Some constexpr symbols for whether sanitizers are enabled Summary: [Folly] Some constexpr symbols for whether sanitizers are enabled. Useful where we need to do or not do some particular thing when sanitizers are enabled or disabled. Such cases do happen. It is better to use a C++ `constexpr` symbol rather than a preprocessor symbol in such cases, where possible. Reviewed By: meyering Differential Revision: D4805110 fbshipit-source-id: ca9ce074edef73dce3a04693dda102698c9cd29f --- diff --git a/folly/Portability.h b/folly/Portability.h index 07426f05..77df9164 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -111,6 +111,21 @@ constexpr bool kIsArchAArch64 = FOLLY_A64 == 1; constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1; } +namespace folly { + +#if FOLLY_SANITIZE_ADDRESS +constexpr bool kIsSanitizeAddress = true; +#else +constexpr bool kIsSanitizeAddress = false; +#endif + +#if FOLLY_SANITIZE_THREAD +constexpr bool kIsSanitizeThread = true; +#else +constexpr bool kIsSanitizeThread = false; +#endif +} + // packing is very ugly in msvc #ifdef _MSC_VER # define FOLLY_PACK_ATTR /**/