[telepathy-qt4/master] Export enabledDebug(), enabledWarning() even in non-debug builds
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Dec 4 07:34:48 PST 2009
The debug(), warning() inlines mean they won't actually be invoked, so
it doesn't matter if there's some trivial cost in terms of function
calls.
---
TelepathyQt4/debug-internal.h | 9 ++++++---
TelepathyQt4/debug.cpp | 20 +++++++++++++++++---
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/TelepathyQt4/debug-internal.h b/TelepathyQt4/debug-internal.h
index 6200ecb..6f5f1e5 100644
--- a/TelepathyQt4/debug-internal.h
+++ b/TelepathyQt4/debug-internal.h
@@ -28,10 +28,13 @@
namespace Tp
{
-#ifdef ENABLE_DEBUG
-QDebug enabledDebug();
-QDebug enabledWarning();
+// The telepathy-farsight Qt 4 binding links to these - they're not API outside
+// this source tarball, but they *are* ABI
+TELEPATHY_QT4_EXPORT QDebug enabledDebug();
+TELEPATHY_QT4_EXPORT QDebug enabledWarning();
+
+#ifdef ENABLE_DEBUG
inline QDebug debug()
{
diff --git a/TelepathyQt4/debug.cpp b/TelepathyQt4/debug.cpp
index 46a5cd6..f74af17 100644
--- a/TelepathyQt4/debug.cpp
+++ b/TelepathyQt4/debug.cpp
@@ -40,7 +40,6 @@
namespace Tp
{
-#ifdef ENABLE_DEBUG
/**
* \fn void enableDebug(bool enable)
@@ -82,7 +81,12 @@ struct DiscardDevice : public QIODevice
return maxsize;
}
} discard;
+}
+
+#ifdef ENABLE_DEBUG
+namespace
+{
bool debugEnabled = false;
bool warningsEnabled = true;
}
@@ -113,7 +117,7 @@ QDebug enabledWarning()
return QDebug(&discard);
}
-#else /* #ifdef ENABLE_DEBUG */
+#else /* !defined(ENABLE_DEBUG) */
void enableDebug(bool enable)
{
@@ -123,6 +127,16 @@ void enableWarnings(bool enable)
{
}
-#endif /* #ifdef ENABLE_DEBUG */
+QDebug enabledDebug()
+{
+ return QDebug(&discard);
+}
+
+QDebug enabledWarning()
+{
+ return QDebug(&discard);
+}
+
+#endif /* !defined(ENABLE_DEBUG) */
} // Tp
--
1.5.6.5
More information about the telepathy-commits
mailing list