GCC 3.1 fixes
authorChris Lattner <sabre@nondot.org>
Wed, 24 Jul 2002 22:20:00 +0000 (22:20 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 24 Jul 2002 22:20:00 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3066 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/HashExtras.h
include/Support/PostOrderIterator.h
include/Support/hash_map
include/Support/hash_set
include/llvm/ADT/HashExtras.h
include/llvm/ADT/PostOrderIterator.h

index da9e3f5cbadd9267d48e4c554fff290413a31454..5887a8311626e6956d7c9323a415fbb98fd17b32 100644 (file)
 #include <Support/hash_map>
 
 // Cannot specialize hash template from outside of the std namespace.
-namespace std {
+namespace HASH_NAMESPACE {
 
-template <> struct hash<string> {
-  size_t operator()(string const &str) const {
+template <> struct hash<std::string> {
+  size_t operator()(std::string const &str) const {
     return hash<char const *>()(str.c_str());
   }
 };
index 29d315e89c90c3cbae5820e0278e513a2d7de2a4..4f94141b5c4406d21f7400a6f5c560b67d036f2d 100644 (file)
 #define LLVM_SUPPORT_POSTORDER_ITERATOR_H
 
 #include "Support/GraphTraits.h"
-#include <iterator>
+#include <Support/iterator>
 #include <stack>
 #include <set>
 
 template<class GraphT, class GT = GraphTraits<GraphT> >
-class po_iterator : public std::forward_iterator<typename GT::NodeType,
-                                                 ptrdiff_t> {
+class po_iterator : public forward_iterator<typename GT::NodeType, ptrdiff_t> {
+  typedef forward_iterator<typename GT::NodeType, ptrdiff_t> super;
+  typedef typename super::pointer pointer;
   typedef typename GT::NodeType          NodeType;
   typedef typename GT::ChildIteratorType ChildItTy;
 
index d6a0ac0faf49627aebda5cc780fd682daf73e74e..af727c42cf17148d9b36f75db7001b857352534a 100644 (file)
 
 #if __GNUC__ == 3
 #include <ext/hash_map>
-using __gnu_cxx::hash_map;
+#ifndef HASH_NAMESPACE
+#define HASH_NAMESPACE __gnu_cxx
+#endif
 #else
 #include <hash_map>
+#ifndef HASH_NAMESPACE
+#define HASH_NAMESPACE std
+#endif
 #endif
 
+using HASH_NAMESPACE::hash_map;
+using HASH_NAMESPACE::hash;
+
 #endif
index 094f892199502c1e46092bff0145a9fed8775480..2214b918613ed129d2e9a8e48a6bd6ffd9fc3e0a 100644 (file)
 #define SUPPORT_HASHSET_H
 #if __GNUC__==3
 #include <ext/hash_set>
-using __gnu_cxx::hash_set;
+#define HASH_NAMESPACE __gnu_cxx
 #else
 #include <hash_set>
+#define HASH_NAMESPACE std
 #endif
+
+using HASH_NAMESPACE::hash_set;
+using HASH_NAMESPACE::hash;
+
+#endif
+
index da9e3f5cbadd9267d48e4c554fff290413a31454..5887a8311626e6956d7c9323a415fbb98fd17b32 100644 (file)
 #include <Support/hash_map>
 
 // Cannot specialize hash template from outside of the std namespace.
-namespace std {
+namespace HASH_NAMESPACE {
 
-template <> struct hash<string> {
-  size_t operator()(string const &str) const {
+template <> struct hash<std::string> {
+  size_t operator()(std::string const &str) const {
     return hash<char const *>()(str.c_str());
   }
 };
index 29d315e89c90c3cbae5820e0278e513a2d7de2a4..4f94141b5c4406d21f7400a6f5c560b67d036f2d 100644 (file)
 #define LLVM_SUPPORT_POSTORDER_ITERATOR_H
 
 #include "Support/GraphTraits.h"
-#include <iterator>
+#include <Support/iterator>
 #include <stack>
 #include <set>
 
 template<class GraphT, class GT = GraphTraits<GraphT> >
-class po_iterator : public std::forward_iterator<typename GT::NodeType,
-                                                 ptrdiff_t> {
+class po_iterator : public forward_iterator<typename GT::NodeType, ptrdiff_t> {
+  typedef forward_iterator<typename GT::NodeType, ptrdiff_t> super;
+  typedef typename super::pointer pointer;
   typedef typename GT::NodeType          NodeType;
   typedef typename GT::ChildIteratorType ChildItTy;