From be9de62c7e951ea7e7cfc932466a40370909bf2d Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 10 Nov 2011 13:16:48 +0100 Subject: [PATCH] Don't let yaffut try to demangle when autoconf figures this won't work --- config.hh.in | 4 ++++ configure.in | 12 ++++++++++++ flower/include/yaffut.hh | 9 +++++++++ 3 files changed, 25 insertions(+) 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 ]) CXXFLAGS="$save_CXXFLAGS" +## Check for usable cxxabi +AC_MSG_CHECKING(for usable C++ demangler) +AC_LINK_IFELSE([#include +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 +#else +#include +#endif #include #include @@ -65,6 +70,7 @@ namespace yaffut template 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 -- 2.39.5