Commit 2549fb3c authored by Peter Griess's avatar Peter Griess

Handle libc++ usage of inline namespaces for std::

Summary:
- libc++ uses inline namespaces in its implementation of the std
namespace; use its macros for our forward-declaring needs.

@override-unit-failures
The hphp_packedtv test has been sitting postponed for a long time. I
can't repro its failure locally anyway.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: simpkins@fb.com

FB internal diff: D998578
parent 85064d3d
......@@ -118,4 +118,15 @@ struct MaxAlign { char c; } __attribute__((aligned));
# define FOLLY_DISABLE_ADDRESS_SANITIZER
#endif
// It turns out that GNU libstdc++ and LLVM libc++ differ on how they implement
// the 'std' namespace; the latter uses inline namepsaces. Wrap this decision
// up in a macro to make forward-declarations easier.
#ifdef _LIBCPP_VERSION
#define FOLLY_NAMESPACE_STD_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
#define FOLLY_NAMESPACE_STD_END _LIBCPP_END_NAMESPACE_STD
#else
#define FOLLY_NAMESPACE_STD_BEGIN namespace std {
#define FOLLY_NAMESPACE_STD_END }
#endif
#endif // FOLLY_PORTABILITY_H_
......@@ -23,6 +23,8 @@
#include <limits>
#include <type_traits>
#include "folly/Portability.h"
#include <bits/c++config.h>
#include <boost/type_traits.hpp>
......@@ -223,7 +225,7 @@ template <class T> struct IsZeroInitializable
* although that is not guaranteed by the standard.
*/
namespace std {
FOLLY_NAMESPACE_STD_BEGIN
template <class T, class U>
struct pair;
......@@ -247,7 +249,7 @@ template <class K, class V, class C, class A>
template <class T>
class shared_ptr;
}
FOLLY_NAMESPACE_STD_END
namespace boost {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment