From a348e154aa2822c13590526d6558e37bda2cdc2b Mon Sep 17 00:00:00 2001 From: Giuseppe Ottaviano Date: Thu, 12 Nov 2015 08:37:14 -0800 Subject: [PATCH] Disable assertions in FBString when used as std::string Reviewed By: Gownta Differential Revision: D2643850 fb-gh-sync-id: 2c4bb844ea2006215b0637cb1ba08c636faefe05 --- folly/FBString.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/folly/FBString.h b/folly/FBString.h index d8dccd80..f7b58ccc 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -32,6 +32,12 @@ #pragma GCC system_header +// When used as std::string replacement always disable assertions. +#ifndef NDEBUG +#define NDEBUG +#define FOLLY_DEFINED_NDEBUG_FOR_FBSTRING +#endif // NDEBUG + // Handle the cases where the fbcode version (folly/Malloc.h) is included // either before or after this inclusion. #ifdef FOLLY_MALLOC_H_ @@ -2553,4 +2559,9 @@ FOLLY_FBSTRING_HASH #undef FBSTRING_LIKELY #undef FBSTRING_UNLIKELY +#ifdef FOLLY_DEFINED_NDEBUG_FOR_FBSTRING +#undef NDEBUG +#undef FOLLY_DEFINED_NDEBUG_FOR_FBSTRING +#endif // FOLLY_DEFINED_NDEBUG_FOR_FBSTRING + #endif // FOLLY_BASE_FBSTRING_H_ -- 2.34.1