Disable assertions in FBString when used as std::string
authorGiuseppe Ottaviano <ott@fb.com>
Thu, 12 Nov 2015 16:37:14 +0000 (08:37 -0800)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Thu, 12 Nov 2015 17:20:19 +0000 (09:20 -0800)
Reviewed By: Gownta

Differential Revision: D2643850

fb-gh-sync-id: 2c4bb844ea2006215b0637cb1ba08c636faefe05

folly/FBString.h

index d8dccd8099f23fba27614bd9a94abd2f36a9ff1c..f7b58ccc24ab9aaf9c39700e48375fe1577cb90d 100644 (file)
 
 #pragma GCC system_header
 
 
 #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_
 // 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
 
 #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_
 #endif // FOLLY_BASE_FBSTRING_H_