diff options
| author | Wilson Fung <[email protected]> | 2012-07-26 03:22:53 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:48:52 -0700 |
| commit | 9a0e4e4a776a963c9950dc3dcd0d23ee0739b755 (patch) | |
| tree | 70c6f73230fe8fcfdd0fd2a3a7eb525e1f145b80 /src/tr1_hash_map.h | |
| parent | 1c7ed16cc28f1d740ac7abc773eb4016d49fcba4 (diff) | |
Clean up the unordered_map fallback support.
- Now there is only one macro for all use of unordered_map in the code.
- Moving all instances of gcc/cuda version detection into a single file.
- Adding a warning when the fallback is triggered.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13542]
Diffstat (limited to 'src/tr1_hash_map.h')
| -rw-r--r-- | src/tr1_hash_map.h | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/tr1_hash_map.h b/src/tr1_hash_map.h index 611d4d4..a2d3334 100644 --- a/src/tr1_hash_map.h +++ b/src/tr1_hash_map.h @@ -29,7 +29,9 @@ // detection and fallback for unordered_map in C++0x #ifdef __cplusplus - #ifdef __GNUC__ + // detect GCC 4.3 or later and use unordered map (part of C++0x) + // unordered map doesn't play nice with _GLIBCXX_DEBUG, just use a map if its enabled. + #if defined( __GNUC__ ) and not defined( _GLIBCXX_DEBUG ) #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 #include <unordered_map> #define tr1_hash_map std::unordered_map @@ -45,23 +47,8 @@ #define tr1_hash_map_ismap 1 #endif - // detect gcc 4.3 and use unordered map (part of c++0x) - // unordered map doesn't play nice with _GLIBCXX_DEBUG, just use a map if its enabled. - #if defined( __GNUC__ ) and not defined( _GLIBCXX_DEBUG ) - #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 - #include <unordered_map> - #define my_hash_map std::unordered_map - #else - #include <ext/hash_map> - namespace std { - using namespace __gnu_cxx; - } - #define my_hash_map std::hash_map - #endif - #else - #include <map> - #define my_hash_map std::map - #define USE_MAP - #endif + #if tr1_hash_map_ismap == 1 + #warning "Pre-C++11 GCC version detected. Downgrading all use of <unordered_map> to <map>. Please upgrade to GCC 4.3 or later for faster simulation." + #endif #endif |
