#include <string>
#include <new>
#include <cxxabi.h>
-#endif // MEMLEAK_CHECK
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef ASSERT
-#undef ASSERT
-#endif
-
-#ifndef SWIG
-
-#define CHECKFORMAT __attribute__ ((__format__(__printf__, 1, 2)))
-
-extern Signal2<void, int, const std::string&> logOutput;
-extern int logOutputConsole;
-
-void CHECKFORMAT eFatal(const char*, ...);
-enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };
-
-#ifdef DEBUG
- void CHECKFORMAT eDebug(const char*, ...);
- void CHECKFORMAT eDebugNoNewLine(const char*, ...);
- void CHECKFORMAT eWarning(const char*, ...);
- #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
-
-#ifdef MEMLEAK_CHECK
typedef struct
{
unsigned int address;
#endif // MEMLEAK_CHECK
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifdef ASSERT
+#undef ASSERT
+#endif
+
+#ifndef SWIG
+
+#define CHECKFORMAT __attribute__ ((__format__(__printf__, 1, 2)))
+
+extern Signal2<void, int, const std::string&> logOutput;
+extern int logOutputConsole;
+
+void CHECKFORMAT eFatal(const char*, ...);
+enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };
+
+#ifdef DEBUG
+ void CHECKFORMAT eDebug(const char*, ...);
+ void CHECKFORMAT eDebugNoNewLine(const char*, ...);
+ void CHECKFORMAT eWarning(const char*, ...);
+ #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
#else // DEBUG
inline void eDebug(const char* fmt, ...)
{
volatile int count;
oRefCount(): count(0) { }
operator volatile int&() { return count; }
- ~oRefCount() {
+ ~oRefCount()
+ {
#ifdef OBJECT_DEBUG
- if (count) eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, count); else eDebug("OBJECT_DEBUG refcount ok! (%p)", this);
+ if (count)
+ eDebug("OBJECT_DEBUG FATAL: %p has %d references!", this, count);
+ else
+ eDebug("OBJECT_DEBUG refcount ok! (%p)", this);
#endif
}
};
delete this; \
}
#else
+ #warning use non optimized implementation of refcounting.
#define DECLARE_REF(x) \
private:oRefCount ref; \
eSingleLock ref_lock; \