Skip to content

Commit

Permalink
Some constexpr symbols for whether sanitizers are enabled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Mar 31, 2017
1 parent c84f534 commit 388266e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions folly/Portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 /**/
Expand Down

0 comments on commit 388266e

Please sign in to comment.