From 50b33d29c25c9cb33ff61988a6fc16ec1a25e6d0 Mon Sep 17 00:00:00 2001 From: Yaacov Akiba Slama Date: Wed, 21 Oct 2015 22:30:22 -0700 Subject: [PATCH] Fix gcc 5.2 compilation when _GLIBCXX_USE_CXX11_ABI is not 0 Summary: Tested in debian stretch when used in hhvm which can now run drupal 7. The compilation error is also fixed by #214 but this fix maintains forward declarations of basic_string and list. Closes https://github.com/facebook/folly/pull/329 Reviewed By: yfeldblum Differential Revision: D2533880 fb-gh-sync-id: 85e18eeeba9efa1b4150217ba526b32b5573e15e --- folly/Portability.h | 10 ++++++++++ folly/Traits.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/folly/Portability.h b/folly/Portability.h index ca8c28a3..c059a3cb 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -208,6 +208,16 @@ namespace std { typedef ::max_align_t max_align_t; } #define FOLLY_NAMESPACE_STD_END } #endif +// If the new c++ ABI is used, __cxx11 inline namespace needs to be added to +// some types, e.g. std::list. +#if _GLIBCXX_USE_CXX11_ABI +# define FOLLY_GLIBCXX_NAMESPACE_CXX11_BEGIN _GLIBCXX_BEGIN_NAMESPACE_CXX11 +# define FOLLY_GLIBCXX_NAMESPACE_CXX11_END _GLIBCXX_END_NAMESPACE_CXX11 +#else +# define FOLLY_GLIBCXX_NAMESPACE_CXX11_BEGIN +# define FOLLY_GLIBCXX_NAMESPACE_CXX11_END +#endif + // Some platforms lack clock_gettime(2) and clock_getres(2). Inject our own // versions of these into the global namespace. #if FOLLY_HAVE_CLOCK_GETTIME diff --git a/folly/Traits.h b/folly/Traits.h index 9701aa15..caeb852c 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -240,8 +240,10 @@ FOLLY_NAMESPACE_STD_BEGIN template struct pair; #ifndef _GLIBCXX_USE_FB +FOLLY_GLIBCXX_NAMESPACE_CXX11_BEGIN template class basic_string; +FOLLY_GLIBCXX_NAMESPACE_CXX11_END #else template class basic_string; @@ -250,8 +252,10 @@ template class vector; template class deque; +FOLLY_GLIBCXX_NAMESPACE_CXX11_BEGIN template class list; +FOLLY_GLIBCXX_NAMESPACE_CXX11_END template class set; template -- 2.34.1