Commit 05e25a14 authored by Robert Ricci's avatar Robert Ricci
Browse files

Make assign build with GCC 4.4.

The main change is to add a NEWER_GCC macro, separate from NEW_GCC, to
detect GCC 4.3 and up.

This is necessary because, in GCC 4.3, hash_fun.h moved from ext/ to
backward/.  New comments in port.h give the details.

common.h, fstring.h: use NEWER_GCC to locate hash_fun.h.  port.h:
define NEWER_GCC if GCC >= 4.3.
parent 1085e4a7
...@@ -15,7 +15,11 @@ ...@@ -15,7 +15,11 @@
*/ */
#ifdef NEW_GCC #ifdef NEW_GCC
#include <ext/hash_map> #include <ext/hash_map>
#include <ext/hash_fun.h> #ifdef NEWER_GCC
#include <backward/hash_fun.h>
#else
#include <ext/hash_fun.h>
#endif
using namespace __gnu_cxx; using namespace __gnu_cxx;
#define RANDOM() random() #define RANDOM() random()
......
...@@ -29,8 +29,11 @@ ...@@ -29,8 +29,11 @@
using namespace std; using namespace std;
#ifdef NEW_GCC #ifdef NEW_GCC
#include <ext/hash_fun.h> #ifdef NEWER_GCC
//#include <hash_fun.h> #include <backward/hash_fun.h>
#else
#include <ext/hash_fun.h>
#endif
using namespace __gnu_cxx; using namespace __gnu_cxx;
#else #else
#include <stl_hash_fun.h> #include <stl_hash_fun.h>
......
...@@ -17,11 +17,25 @@ ...@@ -17,11 +17,25 @@
/* /*
* We have to do these includes differently depending on which version of gcc * We have to do these includes differently depending on which version of gcc
* we're compiling with * we're compiling with
*
* In G++ 4.3, hash_set and hash_map were formally deprecated and
* moved from ext/ to backward/. Well, that's what the release notes
* claim. In fact, on my system, hash_set and hash_map appear in both
* ext/ and backward/. But, hash_fun.h is only in backward/, necessi-
* tating the NEWER_GCC macro.
*
* The real fix is to replace
* hash_set with tr1::unordered_set in <tr1/unordered_set>
* hash_map with tr1::unordered_map in <tr1/unordered_map>
*/ */
#if (__GNUC__ == 3 && __GNUC_MINOR__ > 0) || (__GNUC__ > 3) #if (__GNUC__ == 3 && __GNUC_MINOR__ > 0) || (__GNUC__ > 3)
#define NEW_GCC #define NEW_GCC
#endif #endif
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 4)
#define NEWER_GCC
#endif
#ifdef NEW_GCC #ifdef NEW_GCC
#include <ext/slist> #include <ext/slist>
using namespace __gnu_cxx; using namespace __gnu_cxx;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment