summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-04-25 08:57:18 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-04-25 08:57:18 -0400
commit79750fc575db0966ff9d0530975377c35f630eca (patch)
tree51e7eca97cf34337ff356a793e825a62f5d942d3
parent312b6fe43b3be7bd1618bb6ffd7810787eea75a0 (diff)
downloadgem5-79750fc575db0966ff9d0530975377c35f630eca.tar.xz
clang/gcc: Use STL hash function for int64_t and uint64_t
This patch changes the guards for the definition of hash functions to also exclude the int64_t and uint64_t hash functions in the case we are using the c++0x STL <unordered_map> (and <hash>) or the TR1 version of the same header. Previously the guard only covered the hash function for strings, but it seems there is also no need to define a hash for the 64-bit integer types, and this has caused problems with builds on 32-bit Ubuntu.
-rw-r--r--src/base/hashmap.hh13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/base/hashmap.hh b/src/base/hashmap.hh
index ce9325881..dfdf6ef90 100644
--- a/src/base/hashmap.hh
+++ b/src/base/hashmap.hh
@@ -95,8 +95,9 @@
#define hash_set unordered_set
#define hash_multiset unordered_multiset
-// these versions also have an existing hash function for strings
-#define HAVE_STRING_HASH 1
+// these versions also have an existing hash function for strings and
+// 64-bit integer types
+#define HAVE_HASH_FUNCTIONS 1
#if HAVE_STD_UNORDERED_MAP
@@ -152,6 +153,11 @@ namespace m5 {
//
__hash_namespace_begin
+
+// if the hash functions for 64-bit integer types and strings are not
+// already available, then declare them here
+#if !defined(HAVE_HASH_FUNCTIONS)
+
#if !defined(__LP64__) && !defined(__alpha__) && !defined(__SUNPRO_CC)
template<>
struct hash<uint64_t> {
@@ -168,9 +174,6 @@ __hash_namespace_begin
};
#endif
-// if the hash functions for strings are not already defined, then
-// declare them here
-#if !defined(HAVE_STRING_HASH)
template<>
struct hash<std::string> {
size_t operator()(const std::string &s) const {