From: dooglus Date: Sat, 26 Jan 2008 02:03:45 +0000 (+0000) Subject: Avoid the "deprecated or antiquated header" warning from g++ 4.3 by using and instead of and if they are available. git-svn-id: http://svn.voria.com/code@1494 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/configure.ac b/synfig-core/trunk/configure.ac index 5fd4ecf..868d248 100644 --- a/synfig-core/trunk/configure.ac +++ b/synfig-core/trunk/configure.ac @@ -444,6 +444,36 @@ AC_SUBST(MODULE_DIR) SYNFIGLIB_DIR=$libdir/synfig AC_SUBST(SYNFIGLIB_DIR) +# Check for unordered_map or hash_map headers +AC_CHECK_HEADERS([tr1/unordered_map],[ + AC_DEFINE([HASH_MAP_CLASS],[HASH_MAP_NAMESPACE::unordered_map],[The template name for unordered maps.]) + AC_DEFINE([HASH_MAP_H],[],[The header file to include for unordered maps.]) + AC_DEFINE([HASH_MAP_NAMESPACE],[std::tr1],[The namespace for unordered maps.]) +],[ + AC_CHECK_HEADERS([ext/hash_map],[ + AC_DEFINE([HASH_MAP_CLASS],[HASH_MAP_NAMESPACE::hash_map],[The template name for unordered maps.]) + AC_DEFINE([HASH_MAP_H],[],[The header file to include for unordered maps.]) + AC_DEFINE([HASH_MAP_NAMESPACE],[__gnu_cxx],[The namespace for unordered maps.]) + ],[ + AC_MSG_ERROR([C++ compiler does not seem to support unordered containers]) + ]) +]) + +# Check for unordered_set or hash_set headers +AC_CHECK_HEADERS([tr1/unordered_set],[ + AC_DEFINE([HASH_SET_CLASS],[HASH_SET_NAMESPACE::unordered_set],[The template name for unordered sets.]) + AC_DEFINE([HASH_SET_H],[],[The header file to include for unordered sets.]) + AC_DEFINE([HASH_SET_NAMESPACE],[std::tr1],[The namespace for unordered sets.]) +],[ + AC_CHECK_HEADERS([ext/hash_set],[ + AC_DEFINE([HASH_SET_CLASS],[HASH_SET_NAMESPACE::hash_set],[The template name for unordered sets.]) + AC_DEFINE([HASH_SET_H],[],[The header file to include for unordered sets.]) + AC_DEFINE([HASH_SET_NAMESPACE],[__gnu_cxx],[The namespace for unordered sets.]) + ],[ + AC_MSG_ERROR([C++ compiler does not seem to support unordered containers]) + ]) +]) + diff --git a/synfig-core/trunk/src/synfig/guid.cpp b/synfig-core/trunk/src/synfig/guid.cpp index db0e149..4598c63 100644 --- a/synfig-core/trunk/src/synfig/guid.cpp +++ b/synfig-core/trunk/src/synfig/guid.cpp @@ -23,7 +23,6 @@ /* === H E A D E R S ======================================================= */ -#define HASH_MAP_H #define SUBTRACT_RNG_H #ifdef USING_PCH @@ -48,7 +47,6 @@ #ifdef HASH_MAP_H #include HASH_MAP_H -using namespace __gnu_cxx; #endif #ifdef SUBTRACT_RNG_H @@ -155,7 +153,7 @@ synfig::GUID synfig::GUID::hasher(const String& str) { #ifdef HASH_MAP_H - hash string_hash_; + HASH_MAP_NAMESPACE::hash string_hash_; const unsigned int seed( string_hash_( str.c_str() diff --git a/synfig-core/trunk/src/synfig/guidset.h b/synfig-core/trunk/src/synfig/guidset.h index e8a2bce..1ff2fe3 100644 --- a/synfig-core/trunk/src/synfig/guidset.h +++ b/synfig-core/trunk/src/synfig/guidset.h @@ -25,8 +25,6 @@ #ifndef __SYNFIG_GUIDSET_H #define __SYNFIG_GUIDSET_H -#define HASH_SET_H - /* === H E A D E R S ======================================================= */ #include "guid.h" @@ -49,7 +47,7 @@ class GUIDSet : public #ifdef HASH_SET_H std::set #else -std::hash_set +HASH_SET_CLASS #endif { }; // END of class GUIDSet diff --git a/synfig-core/trunk/src/synfig/node.cpp b/synfig-core/trunk/src/synfig/node.cpp index b957762..f6a820e 100644 --- a/synfig-core/trunk/src/synfig/node.cpp +++ b/synfig-core/trunk/src/synfig/node.cpp @@ -22,8 +22,6 @@ /* === H E A D E R S ======================================================= */ -#define HASH_MAP_H - #ifdef USING_PCH # include "pch.h" #else @@ -36,7 +34,6 @@ #ifdef HASH_MAP_H #include HASH_MAP_H -using namespace __gnu_cxx; #else #include #endif @@ -83,7 +80,7 @@ extern clock_t _clock(); /* === G L O B A L S ======================================================= */ #ifdef HASH_MAP_H -typedef hash_map GlobalNodeMap; +typedef HASH_MAP_CLASS GlobalNodeMap; #else typedef map GlobalNodeMap; #endif diff --git a/synfig-studio/trunk/configure.ac b/synfig-studio/trunk/configure.ac index 85a263d..e290def 100755 --- a/synfig-studio/trunk/configure.ac +++ b/synfig-studio/trunk/configure.ac @@ -132,6 +132,36 @@ if test $with_libfmod = "yes" ; then { FMOD_LIBS= } ; fi +# Check for unordered_map or hash_map headers +AC_CHECK_HEADERS([tr1/unordered_map],[ + AC_DEFINE([HASH_MAP_CLASS],[HASH_MAP_NAMESPACE::unordered_map],[The template name for unordered maps.]) + AC_DEFINE([HASH_MAP_H],[],[The header file to include for unordered maps.]) + AC_DEFINE([HASH_MAP_NAMESPACE],[std::tr1],[The namespace for unordered maps.]) +],[ + AC_CHECK_HEADERS([ext/hash_map],[ + AC_DEFINE([HASH_MAP_CLASS],[HASH_MAP_NAMESPACE::hash_map],[The template name for unordered maps.]) + AC_DEFINE([HASH_MAP_H],[],[The header file to include for unordered maps.]) + AC_DEFINE([HASH_MAP_NAMESPACE],[__gnu_cxx],[The namespace for unordered maps.]) + ],[ + AC_MSG_ERROR([C++ compiler does not seem to support unordered containers]) + ]) +]) + +# Check for unordered_set or hash_set headers +AC_CHECK_HEADERS([tr1/unordered_set],[ + AC_DEFINE([HASH_SET_CLASS],[HASH_SET_NAMESPACE::unordered_set],[The template name for unordered sets.]) + AC_DEFINE([HASH_SET_H],[],[The header file to include for unordered sets.]) + AC_DEFINE([HASH_SET_NAMESPACE],[std::tr1],[The namespace for unordered sets.]) +],[ + AC_CHECK_HEADERS([ext/hash_set],[ + AC_DEFINE([HASH_SET_CLASS],[HASH_SET_NAMESPACE::hash_set],[The template name for unordered sets.]) + AC_DEFINE([HASH_SET_H],[],[The header file to include for unordered sets.]) + AC_DEFINE([HASH_SET_NAMESPACE],[__gnu_cxx],[The namespace for unordered sets.]) + ],[ + AC_MSG_ERROR([C++ compiler does not seem to support unordered containers]) + ]) +]) + # -- H E A D E R S -------------------------------------------- AC_CHECK_HEADERS([unistd.h signal.h fcntl.h]) diff --git a/synfig-studio/trunk/src/gtkmm/duck.h b/synfig-studio/trunk/src/gtkmm/duck.h index 618662f..2a38d64 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.h +++ b/synfig-studio/trunk/src/gtkmm/duck.h @@ -44,16 +44,13 @@ /* === M A C R O S ========================================================= */ -#define HASH_MAP_H -#define HASH_SET_H - #ifdef HASH_MAP_H #include HASH_MAP_H #ifndef __STRING_HASH__ #define __STRING_HASH__ class StringHash { - __gnu_cxx::hash hasher_; + HASH_MAP_NAMESPACE::hash hasher_; public: size_t operator()(const synfig::String& x)const { @@ -251,9 +248,9 @@ operator&(const Duck::Type lhs, const Duck::Type rhs) class DuckMap : public #ifdef HASH_MAP_H -__gnu_cxx::hash_map,synfig::GUIDHash> +HASH_MAP_CLASS,synfig::GUIDHash> { - typedef __gnu_cxx::hash_map,synfig::GUIDHash> PARENT_TYPE; + typedef HASH_MAP_CLASS,synfig::GUIDHash> PARENT_TYPE; #else std::map > { diff --git a/synfig-studio/trunk/src/gtkmm/duckmatic.h b/synfig-studio/trunk/src/gtkmm/duckmatic.h index e311b7f..b8d8247 100644 --- a/synfig-studio/trunk/src/gtkmm/duckmatic.h +++ b/synfig-studio/trunk/src/gtkmm/duckmatic.h @@ -50,15 +50,13 @@ /* === M A C R O S ========================================================= */ -#define HASH_MAP_H - #ifdef HASH_MAP_H #include HASH_MAP_H #ifndef __STRING_HASH__ #define __STRING_HASH__ class StringHash { - __gnu_cxx::hash hasher_; + HASH_MAP_NAMESPACE::hash hasher_; public: size_t operator()(const synfig::String& x)const { @@ -124,7 +122,7 @@ class Duckmatic public: #ifdef HASH_MAP_H -typedef __gnu_cxx::hash_map,synfig::GUIDHash> DuckDataMap; +typedef HASH_MAP_CLASS,synfig::GUIDHash> DuckDataMap; #else typedef std::map > DuckDataMap; #endif