summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2011-11-10 13:16:48 +0100
committerDavid Kastrup <dak@gnu.org>2011-11-11 14:16:48 +0100
commitbe9de62c7e951ea7e7cfc932466a40370909bf2d (patch)
tree1b4ad13b946f03649183066ef8232181865cca35
parentcd229915fc873fdb6fd0125827452cb0ba0067a7 (diff)
Don't let yaffut try to demangle when autoconf figures this won't work
-rw-r--r--config.hh.in4
-rw-r--r--configure.in12
-rw-r--r--flower/include/yaffut.hh9
3 files changed, 25 insertions, 0 deletions
diff --git a/config.hh.in b/config.hh.in
index 3863a88d0d..800d77d8a2 100644
--- a/config.hh.in
+++ b/config.hh.in
@@ -94,3 +94,7 @@
/* define if Guile has type scm_t_subr */
#define HAVE_GUILE_SUBR_TYPE 0
+
+/* define if cxxabi.h has workable demangler */
+
+#define HAVE_CXA_DEMANGLE 0
diff --git a/configure.in b/configure.in
index cf0178f457..3770c89f9d 100644
--- a/configure.in
+++ b/configure.in
@@ -123,6 +123,18 @@ AC_CHECK_TYPES([scm_t_subr],
[#include <libguile.h>])
CXXFLAGS="$save_CXXFLAGS"
+## Check for usable cxxabi
+AC_MSG_CHECKING(for usable C++ demangler)
+AC_LINK_IFELSE([#include <cxxabi.h>
+int main(){
+ size_t sz;
+ int status;
+ char *ptr = abi::__cxa_demangle ("", 0, &sz, &status);
+ return 0;
+ }], [AC_DEFINE(HAVE_CXA_DEMANGLE)
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT([no, use c++filt -t for manual demangling])])
+
## check rational bugfix.
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
diff --git a/flower/include/yaffut.hh b/flower/include/yaffut.hh
index 376c036ed1..cf444626d9 100644
--- a/flower/include/yaffut.hh
+++ b/flower/include/yaffut.hh
@@ -6,7 +6,12 @@
#ifndef __YAFFUT_H__
#define __YAFFUT_H__
+#include "config.hh"
+#if HAVE_CXA_DEMANGLE
#include <cxxabi.h>
+#else
+#include <typeinfo>
+#endif
#include <cmath>
#include <cstring>
@@ -65,6 +70,7 @@ namespace yaffut
template <typename T>
std::string demangle ()
{
+#if HAVE_CXA_DEMANGLE
size_t sz;
int status;
char *ptr = abi::__cxa_demangle (typeid (T).name (), 0, &sz, &status);
@@ -76,6 +82,9 @@ std::string demangle ()
name = name.substr (pos + 2);
}
return name;
+#else
+ return typeid (T).name ();
+#endif
}
struct ITest