diff options
author | Matt Hauck <matthauck@gmail.com> | 2017-07-10 16:43:18 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-07-10 16:43:18 -0700 |
commit | 9ab7c73f7c989afa777a40ff2a7c5f0f138be22c (patch) | |
tree | 33f23f2f6f369a69235feeae839b7995f2c4b8b2 /src | |
parent | 126082c371d2320255ac8ff7d68bef25a919572d (diff) |
Fix missing std::tr1::hash on GCC 4.1 (#2907)
Rather than crashing on use (doh!) better to just declare this platform
is missing a proper hash_map/hash_set implementation and use
the std::map/std::set emulation.
Fixes regression introduced by #1913
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/stubs/hash.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/google/protobuf/stubs/hash.h b/src/google/protobuf/stubs/hash.h index a997e04b..5924de98 100644 --- a/src/google/protobuf/stubs/hash.h +++ b/src/google/protobuf/stubs/hash.h @@ -40,7 +40,6 @@ #define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1 #define GOOGLE_PROTOBUF_HAVE_HASH_SET 1 -#define GOOGLE_PROTOBUF_HAVE_64BIT_HASH 1 // Use C++11 unordered_{map|set} if available. #if ((_LIBCPP_STD_VER >= 11) || \ @@ -93,8 +92,11 @@ # define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set # endif +// GCC <= 4.1 does not define std::tr1::hash for `long long int` or `long long unsigned int` # if __GNUC__ == 4 && __GNUC__MINOR__ <= 1 -# undef GOOGLE_PROTOBUF_HAVE_64BIT_HASH +# define GOOGLE_PROTOBUF_MISSING_HASH +# include <map> +# include <set> # endif // Version checks for MSC. |