From: Yaacov Akiba Slama Date: Thu, 22 Oct 2015 05:30:22 +0000 (-0700) Subject: Fix gcc 5.2 compilation when _GLIBCXX_USE_CXX11_ABI is not 0 X-Git-Tag: deprecate-dynamic-initializer~305 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=50b33d29c25c9cb33ff61988a6fc16ec1a25e6d0;p=folly.git 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 --- 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