Commit b79d0dcc authored by Robert Ricci's avatar Robert Ricci

Generalize check for newer versions of gcc so that it works for

4.x . Also, set things up so I only have to write the conditional
in one place, port.h
parent e42c3f90
......@@ -23,7 +23,7 @@ using namespace std;
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_map>
#include <ext/slist>
using namespace __gnu_cxx;
......
......@@ -7,11 +7,13 @@
#ifndef __COMON_H
#define __COMON_H
#include "port.h"
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_map>
#include <ext/hash_fun.h>
using namespace __gnu_cxx;
......@@ -184,7 +186,7 @@ struct eqstr
}
};
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
namespace __gnu_cxx
{
#endif
......@@ -195,7 +197,7 @@ namespace __gnu_cxx
return hash< const char* >()( x.c_str() );
}
};
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
};
#endif
......@@ -236,7 +238,7 @@ template <class T> struct hashptr {
* Needed for the transition from gcc 2.95 to 3.x - the new gcc puts some
* non-standard (ie. SGI) STL extensions in different place
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#define HASH_MAP <ext/hash_map>
#else
#define HASH_MAP
......
......@@ -21,11 +21,13 @@
* - O(1) hashing time for any string
*/
#include "port.h"
#include <iostream>
#include <map>
using namespace std;
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_fun.h>
using namespace __gnu_cxx;
#else
......@@ -183,7 +185,7 @@ class fstring {
};
// A hash function for fstrings
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
namespace __gnu_cxx {
#endif
template<> struct hash<fstring> {
......@@ -192,7 +194,7 @@ template<> struct hash<fstring> {
return (size_t)__str.hash();
}
};
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
};
#endif
......
......@@ -16,7 +16,7 @@
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
......
......@@ -28,7 +28,7 @@ using namespace std;
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_set>
#include <ext/hash_map>
using namespace __gnu_cxx;
......
......@@ -18,7 +18,11 @@
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#if (__GNUC__ == 3 && __GNUC_MINOR__ > 0) || (__GNUC__ > 3)
#define NEW_GCC
#endif
#ifdef NEW_GCC
#include <ext/slist>
using namespace __gnu_cxx;
#else
......
......@@ -14,7 +14,7 @@
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_map>
#include <ext/hash_set>
using namespace __gnu_cxx;
......
......@@ -14,7 +14,7 @@
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
......
......@@ -7,11 +7,13 @@
#ifndef __VIRTUAL_H
#define __VIRTUAL_H
#include "port.h"
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#ifdef NEW_GCC
#include <queue>
using namespace std;
#else
......
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