[reSIProcate] [PATCH] Don't use deprecated header files
Hi,
the following patch uses tr1::unordered_map/set as HashValue
implementation. Unfortunatly the usage of this header file exposes some
missing header files in other places.
Tested on Debian Sid (GCC 4.3.2).
Thanks,
Gregor
From: Gregor Jasny <gjasny@xxxxxx>
Subject: [PATCH] features-svn/no-deprecated-headers
Don't include deprecated headers.
See: http://gcc.gnu.org/gcc-4.3/changes.html
Signed-off-by: Gregor Jasny <gjasny@xxxxxx>
---
repro/BerkeleyDb.cxx | 1 +
resip/stack/ParserContainer.hxx | 1 +
rutil/HashMap.hxx | 23 ++++++++++++++++++++++-
rutil/dns/RROverlay.cxx | 1 +
rutil/test/testRandomHex.cxx | 2 +-
5 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/repro/BerkeleyDb.cxx b/repro/BerkeleyDb.cxx
index 9eee2ef..95f1cf7 100644
--- a/repro/BerkeleyDb.cxx
+++ b/repro/BerkeleyDb.cxx
@@ -4,6 +4,7 @@
#include <fcntl.h>
#include <cassert>
+#include <cstdlib>
#include "rutil/WinLeakCheck.hxx"
#include "rutil/Data.hxx"
diff --git a/resip/stack/ParserContainer.hxx b/resip/stack/ParserContainer.hxx
index 8262741..0f881d7 100644
--- a/resip/stack/ParserContainer.hxx
+++ b/resip/stack/ParserContainer.hxx
@@ -1,6 +1,7 @@
#ifndef RESIP_ParserContainer_hxx
#define RESIP_ParserContainer_hxx
+#include <algorithm>
#include <iterator>
#include "resip/stack/HeaderFieldValueList.hxx"
diff --git a/rutil/HashMap.hxx b/rutil/HashMap.hxx
index 399bb49..5dff8ae 100644
--- a/rutil/HashMap.hxx
+++ b/rutil/HashMap.hxx
@@ -3,7 +3,28 @@
// !cj! if all these machine have to use map then we can just delete them and use the default
-# if ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) || ( __GNUC__ > 3 )
+# if ( (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) ) || ( __GNUC__ > 4 )
+# include <tr1/unordered_map>
+# include <tr1/unordered_set>
+# define HASH_MAP_NAMESPACE std::tr1
+# define HashMap std::tr1::unordered_map
+# define HashSet std::tr1::unordered_set
+
+#define HashValue(type) \
+namespace std \
+{ \
+namespace tr1 \
+{ \
+template <> \
+struct hash<type> \
+{ \
+ size_t operator()(const type& data) const; \
+}; \
+} \
+}
+#define HashValueImp(type, ret) size_t HASH_MAP_NAMESPACE::hash<type>::operator()(const type& data) const { return ret; }
+
+# elif ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) || ( __GNUC__ > 3 )
# include <ext/hash_map>
# include <ext/hash_set>
# define HASH_MAP_NAMESPACE __gnu_cxx
diff --git a/rutil/dns/RROverlay.cxx b/rutil/dns/RROverlay.cxx
index 4e20933..3d4dbd4 100644
--- a/rutil/dns/RROverlay.cxx
+++ b/rutil/dns/RROverlay.cxx
@@ -13,6 +13,7 @@
#endif
#endif
+#include <cstdlib>
#include <vector>
#include "rutil/Data.hxx"
#include "rutil/BaseException.hxx"
diff --git a/rutil/test/testRandomHex.cxx b/rutil/test/testRandomHex.cxx
index a305f6c..0296dad 100644
--- a/rutil/test/testRandomHex.cxx
+++ b/rutil/test/testRandomHex.cxx
@@ -1,4 +1,4 @@
-
+#include <cstdlib>
#include <iostream>
#include <set>
--
tg: (d8f0129..) features-svn/no-deprecated-headers (depends on: resiprocate-svn)