#pragma GCC system_header
-#include "basic_fbstring_malloc.h"
+#include "basic_fbstring_malloc.h" // @manual
// When used as std::string replacement always disable assertions.
#define FBSTRING_ASSERT(expr) /* empty */
#else // !_LIBSTDCXX_FBSTRING
+#include <folly/CppAttributes.h>
#include <folly/Portability.h>
// libc++ doesn't provide this header, nor does msvc
#define throw FOLLY_FBSTRING_MAY_NOT_USE_THROW
#ifdef _LIBSTDCXX_FBSTRING
-namespace std _GLIBCXX_VISIBILITY(default) {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#define FOLLY_FBSTRING_BEGIN_NAMESPACE \
+ namespace std _GLIBCXX_VISIBILITY(default) { \
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+#define FOLLY_FBSTRING_END_NAMESPACE \
+ _GLIBCXX_END_NAMESPACE_VERSION \
+ } // namespace std
#else
-namespace folly {
+#define FOLLY_FBSTRING_BEGIN_NAMESPACE namespace folly {
+#define FOLLY_FBSTRING_END_NAMESPACE } // namespace folly
#endif
+FOLLY_FBSTRING_BEGIN_NAMESPACE
+
#if defined(__clang__)
# if __has_feature(address_sanitizer)
# define FBSTRING_SANITIZE_ADDRESS
if (RefCounted::refs(ml_.data_) > 1) {
return ml_.size_;
}
- default: {}
+ break;
+ default:
+ break;
}
return ml_.capacity();
}
switch ((byteSize + wordWidth - 1) / wordWidth) { // Number of words.
case 3:
ml_.capacity_ = reinterpret_cast<const size_t*>(data)[2];
+ FOLLY_FALLTHROUGH;
case 2:
ml_.size_ = reinterpret_cast<const size_t*>(data)[1];
+ FOLLY_FALLTHROUGH;
case 1:
ml_.data_ = *reinterpret_cast<Char**>(const_cast<Char*>(data));
+ FOLLY_FALLTHROUGH;
case 0:
break;
}
template <class T, class R, class A, class S>
FOLLY_ASSUME_RELOCATABLE(basic_fbstring<T, R, A, S>);
-#else
-_GLIBCXX_END_NAMESPACE_VERSION
#endif
-} // namespace folly
+FOLLY_FBSTRING_END_NAMESPACE
#ifndef _LIBSTDCXX_FBSTRING