]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/yaffut.hh
Issue 2036: keep make test in flower from warnings
[lilypond.git] / flower / include / yaffut.hh
index 376c036ed1ff617304395f61ac86aca52fe2acf6..0da01807d48a263cba2cb3736f51d14f21ba0873 100644 (file)
@@ -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
@@ -269,7 +278,7 @@ struct Test: public ITest, public virtual Suite
   Test (): Suite ()
   {
     Registrator<Suite, Case>* r = &s_Registrator;
-    r = 0;
+    (void)r;
   }
   template <typename E, typename T>
   void assert_throw (void (T::*mf) (), const char *at)
@@ -293,7 +302,7 @@ struct Test<Case, void>: public ITest
   Test ()
   {
     Registrator<Case, void>* r = &s_Registrator;
-    r = 0;
+    (void)r;
   }
   template <typename E, typename T>
   void assert_throw (void (T::*mf) (), const char *at)