[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [PATCH] User-friendly kDebug (was: Re: KDE/kdepim/libkdepim)
From: Thiago Macieira <thiago () kde ! org>
Date: 2007-12-27 12:02:46
Message-ID: 200712271002.46911.thiago () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Marc Mutz wrote:
>The attached patch implements the (trivial) part for kdebug.h.
> Technically, it violates the ODR, but since it's just about static
> inline'ed functions (except for KDebug::operator()s, which give me a
> ever-so-slight headache), and only ever about default arguments, it
> should be safe.
Thanks Marc. The patch is very nice and welcome.
We just have to add somewhere the instructions to using it: you must
define the default debug area before including any KDE headers.
As a side-effect, there must be no kDebug() in header files anywhere,
inlined or not.
I'd also like to apply the following patch, which brings the debug-mode
macros to the same level as the release-mode ones. This will catch early
on syntax errors:
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
["kdebug-if-else.diff" (text/x-diff)]
diff --git a/kdecore/io/kdebug.h b/kdecore/io/kdebug.h
index 0981c80..170156f 100644
--- a/kdecore/io/kdebug.h
+++ b/kdecore/io/kdebug.h
@@ -217,12 +217,12 @@ public:
};
#if !defined(KDE_NO_DEBUG_OUTPUT)
-# define kDebug KDebug(QtDebugMsg, __FILE__, __LINE__, Q_FUNC_INFO)
+# define kDebug if (0); else KDebug(QtDebugMsg, __FILE__, __LINE__, Q_FUNC_INFO)
#else
# define kDebug if (1); else kDebug
#endif
#if !defined(KDE_NO_WARNING_OUTPUT)
-# define kWarning KDebug(QtWarningMsg, __FILE__, __LINE__, Q_FUNC_INFO)
+# define kWarning if (0); else KDebug(QtWarningMsg, __FILE__, __LINE__, Q_FUNC_INFO)
#else
# define kWarning if (1); else kWarning
#endif
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic