diff options
author | jfroy@chromium.org <jfroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-11 00:15:18 +0000 |
---|---|---|
committer | jfroy@chromium.org <jfroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-11 00:15:18 +0000 |
commit | 9a07d1df6922bd5bdc20d5072bf7be8edadc2fa1 (patch) | |
tree | 09bf95d13d0fe3ebdd8db66e0e6a2fcd5a1d8038 /third_party | |
parent | 593d160f48291bb67092f9263fcf0a622290e831 (diff) | |
download | chromium_src-9a07d1df6922bd5bdc20d5072bf7be8edadc2fa1.zip chromium_src-9a07d1df6922bd5bdc20d5072bf7be8edadc2fa1.tar.gz chromium_src-9a07d1df6922bd5bdc20d5072bf7be8edadc2fa1.tar.bz2 |
Import C++11 headers for unordered map and set when using libc++ in protobuf's config header to avoid warnings.
BUG=366218
TBR=brettw
Review URL: https://codereview.chromium.org/246633012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/protobuf/config.h | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/third_party/protobuf/config.h b/third_party/protobuf/config.h index dcc0041..dc4f1a4 100644 --- a/third_party/protobuf/config.h +++ b/third_party/protobuf/config.h @@ -1,29 +1,69 @@ +/* Modified for Chromium to support stlport and libc++ adaptively */ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ -/* the name of <hash_set> */ +/* We want to detect which header files to include for the unordered (hash) + collections standardized in C++11 but first introduced as part of TR1. + Specifically, we want to avoid including ext/ headers when using libc++ as + it will generate noisy build warnings. + + We take a several-tier approach. First, attempt to use clang's __has_include + and test for libc++'s configuration header. If that isn't available, include + <new> which will define libc++'s version macro (if using libc++). + + There are no really good alternative headers that do less work. For example, + ciso646 and cstdbool and commonly recommended, but they both have issues. + The first has side effects with MSVC, and the second does not exists on Apple + platforms (the system libstdc++ is too old). + + This dynamic check is necessary to allow using this normally dynamically + generated header with Chromium's many supported build configurations. It + should be expanded to import the right header on other platforms as + desired. */ + +#if defined(__has_include) +#if __has_include(<__config>) +#include <__config> +#else // __has_include(<__config>) +#include <new> +#endif // __has_include(<__config>) +#endif // defined(__has_include) + +/* the name of <hash_map> */ +#if defined(_LIBCPP_VERSION) +#define HASH_MAP_CLASS unordered_map +#else #define HASH_MAP_CLASS hash_map +#endif -/* the location of <hash_map> */ +/* the location of <unordered_map> or <hash_map> */ #if defined(USE_STLPORT) #define HASH_MAP_H <hash_map> +#elif defined(_LIBCPP_VERSION) +#define HASH_MAP_H <unordered_map> #else #define HASH_MAP_H <ext/hash_map> #endif /* the namespace of hash_map/hash_set */ -#if defined(USE_STLPORT) +#if defined(USE_STLPORT) || defined(_LIBCPP_VERSION) #define HASH_NAMESPACE std #else #define HASH_NAMESPACE __gnu_cxx #endif /* the name of <hash_set> */ +#if defined(_LIBCPP_VERSION) +#define HASH_SET_CLASS unordered_set +#else #define HASH_SET_CLASS hash_set +#endif -/* the location of <hash_set> */ +/* the location of <unordered_set> or <hash_set> */ #if defined(USE_STLPORT) #define HASH_SET_H <hash_set> +#elif defined(_LIBCPP_VERSION) +#define HASH_SET_H <unordered_set> #else #define HASH_SET_H <ext/hash_set> #endif |