]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/yaffut.hh
Doc-es: various updates.
[lilypond.git] / flower / include / yaffut.hh
index 376c036ed1ff617304395f61ac86aca52fe2acf6..cd882461f4fdcfd1b829c651763de6bf36bb22a3 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>
@@ -16,6 +21,7 @@
 #include <memory>
 #include <sstream>
 #include <stdexcept>
+#include <unistd.h>
 
 #define YAFFUT_STRINGIZE(x) YAFFUT_STRINGIZE_(x)
 #define YAFFUT_STRINGIZE_(x) #x
@@ -65,6 +71,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 +83,9 @@ std::string demangle ()
       name = name.substr (pos + 2);
     }
   return name;
+#else
+  return typeid (T).name ();
+#endif
 }
 
 struct ITest
@@ -268,8 +278,8 @@ struct Test: public ITest, public virtual Suite
   static Registrator<Suite, Case> s_Registrator;
   Test (): Suite ()
   {
-    Registrator<Suite, Case>r = &s_Registrator;
-    r = 0;
+    Registrator<Suite, Case> *r = &s_Registrator;
+    (void)r;
   }
   template <typename E, typename T>
   void assert_throw (void (T::*mf) (), const char *at)
@@ -292,8 +302,8 @@ struct Test<Case, void>: public ITest
   static Registrator<Case, void> s_Registrator;
   Test ()
   {
-    Registrator<Case, void>r = &s_Registrator;
-    r = 0;
+    Registrator<Case, void> *r = &s_Registrator;
+    (void)r;
   }
   template <typename E, typename T>
   void assert_throw (void (T::*mf) (), const char *at)
@@ -385,7 +395,7 @@ void assert_throw (void (*pf) (), const char *at = "")
 
 #ifdef YAFFUT_MAIN
 
-#include <iostream>
+#include <sys/types.h>
 
 int main (int argc, const char *argv[])
 {