[DynInst_API:] [PATCH 1/2] common: Use __GLIBCXX__ for libstdc++ checks


Date: Tue, 19 Nov 2013 14:52:11 -0800
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH 1/2] common: Use __GLIBCXX__ for libstdc++ checks
A Dyninst client might choose to compile with Clang and libstdc++.
Clang does set __GNUC__ macros, but only as if it were GCC 4.2.1, which
means checks looking for libstdc++ features were misled.  Those checks
are better served by __GLIBCXX__, which is a unique date stamp for each
GCC release.
---
 common/h/dyntypes.h | 3 +--
 common/h/util.h     | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/h/dyntypes.h b/common/h/dyntypes.h
index b314b15..78dc3d9 100644
--- a/common/h/dyntypes.h
+++ b/common/h/dyntypes.h
@@ -55,8 +55,7 @@
   #include <functional>
   #define DECLTHROW(x) throw(x)
   //***************** GCC ***********************
-   #if (__GNUC__ > 4) || \
-      (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+   #if defined (__GLIBCXX__) && (__GLIBCXX__ >= 20080306)
       //**************** GCC >= 4.3.0 ***********
       #include <tr1/unordered_set>
       #include <tr1/unordered_map>
diff --git a/common/h/util.h b/common/h/util.h
index 182f559..963d2c4 100644
--- a/common/h/util.h
+++ b/common/h/util.h
@@ -219,7 +219,7 @@
  * the compiler are fine. 
  */
 #if !((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__))
-#if (__GNUC__ == 4 && __GNUC_MINOR__ == 7 && ((__GNUC_PATCHLEVEL__ == 0) || (__GNUC_PATCHLEVEL__ == 1)))
+#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20120322) && (__GLIBCXX__ < 20120920)
 #error "Using GCC 4.7.0 or 4.7.1 with Dyninst requires the -std:c++0x or -std:c++11 flag. Other versions do not."
 #endif
 #endif
-- 
1.8.3.1

[← Prev in Thread] Current Thread [Next in Thread→]