#ifndef __YAFFUT_H__
#define __YAFFUT_H__
+#include "config.hh"
+#if HAVE_CXA_DEMANGLE
#include <cxxabi.h>
+#else
+#include <typeinfo>
+#endif
#include <cmath>
#include <cstring>
#include <memory>
#include <sstream>
#include <stdexcept>
+#include <unistd.h>
#define YAFFUT_STRINGIZE(x) YAFFUT_STRINGIZE_(x)
#define YAFFUT_STRINGIZE_(x) #x
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);
name = name.substr (pos + 2);
}
return name;
+#else
+ return typeid (T).name ();
+#endif
}
struct ITest
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)
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)
#ifdef YAFFUT_MAIN
-#include <iostream>
+#include <sys/types.h>
int main (int argc, const char *argv[])
{