Version: r751213 (using KDE Devel) Installed from: Compiled sources Compiler: g++ 4.2.1 openSuSE 10.3 OS: Linux [ 0%] Building CXX object kioslave/sieve/CMakeFiles/kio_sieve.dir/sieve.o kdepimlibs/kioslave/sieve/sieve.cpp: In function ‘QDebug ksDebug()’: kdepimlibs/kioslave/sieve/sieve.cpp:46: error: expected primary-expression before ‘if’ kdepimlibs/kioslave/sieve/sieve.cpp:46: error: expected ‘;’ before ‘if’ kdepimlibs/kioslave/sieve/sieve.cpp: In function ‘QDebug ksDebug(bool)’: kdepimlibs/kioslave/sieve/sieve.cpp:47: error: expected primary-expression before ‘if’ kdepimlibs/kioslave/sieve/sieve.cpp:47: error: expected ‘;’ before ‘if’ If I set CMAKE_BUILD_TYPE to Debug it builds fine, only with Release it breaks.
RelWithDebugInfo also builds
kdebase breaks also: kdebase/workspace/kdm/kfrontend/themer/kdmitem.cpp: In member function ‘void KdmItem::showStructure(const QString&)’: kdebase/workspace/kdm/kfrontend/themer/kdmitem.cpp:600: error: expected primary-expression before ‘if This is once again a kDebug() call.
*** Bug 154468 has been marked as a duplicate of this bug. ***
After commit r751697 by tmcguire on kdepim, pluginloadbase.cpp now compiled fine but the same error appeared at : In file included from /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmheaders.cpp:17: /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h: In function ‘kndbgstream kmDebug()’: /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h:21: erreur: expected primary-expression before ‘if’ /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h:21: erreur: expected ‘;’ before ‘if’ /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h: In function ‘kndbgstream kmDebug(bool)’: /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h:22: erreur: expected primary-expression before ‘if’ /var/tmp/portage/kde-base/kdepim-9999.4/work/kdepim-9999.4/kmail/kmdebug.h:22: erreur: expected ‘;’ before ‘if’ sorry to high-jacked a bit the thread (i came from Bug 154468), just to say there's progress but not a complete solution for now
trying to understand kdebug.h. Interesting piece of headers. If i understand correctly the line #define kDebug if ( 1 ); kDebug use in release mode is used to completely strip the debug code by the compiler as unused code and still provide a correct code (syntax wise) ? Perhaps would be cleaner with KDebug( ... ) instead of kDebug (a bit frightened by the recursion in define ) and more symmetric of the debug case but that's another story. if i understand it correctly (?) in this case kDebug() should not be used to initialized a variable ( will work only in debug mode ). so kdmitemp.cpp in kdebase need this ulta simple change : QDebug ds = kDebug(); if (!pfx.isEmpty()) ds << (qPrintable( pfx ) + 1); ds << objectName() << qPrintable( itemType ) << area; change to : if (!pfx.isEmpty()) kDebug() << (qPrintable( pfx ) + 1); kDebug() << objectName() << qPrintable( itemType ) << area; and kmdebug.h in kdepim should be changed to something like this 0a11,16 > // return type of kmDebug() depends on NDEBUG define: > #ifdef NDEBUG > # define kmail_dbgstream kndbgstream > #else > # define kmail_dbgstream kdbgstream > #endif 15,20c21,22 < #if !defined( KDE_NO_DEBUG_OUTPUT ) < static inline kdbgstream kmDebug() { return kDebug( kmail_debug_area ); } < static inline kdbgstream kmDebug( bool cond ) { return kDebug( cond, kmail_debug_area ); } < #else < #define kmDebug kDebug < #endif --- > static inline kmail_dbgstream kmDebug() { return kDebug( kmail_debug_area ); } > static inline kmail_dbgstream kmDebug( bool cond ) { return kDebug( cond, kmail_debug_area ); } and a small correction to certificatewizarpimpl.cpp in kleopatra for the same type of problem as KdmItem.cpp ( replace the kDebug var by implicite call to kDebug ) < kDebug() << "requirementsAreMet(): checking \"" << key << "\" against \"" << le->text() << "\":"; --- > #ifndef NDEBUG > kdbgstream s = kDebug(); > #else > kndbgstream s = kDebug(); > #endif > s << "requirementsAreMet(): checking \"" << key << "\" against \"" << le->text() << "\":"; 158c163 < kDebug() << "required field is empty!"; --- > s << "required field is empty!"; 161c166 < kDebug() << "ok" << endl; --- > s << "ok" << endl; There's still a problem in kmail/kmfilteraction.cpp with ThreadWeaver::debug left but for the moment i have no clean solution
I'm changing the product to kdelibs as kDebug is from there.
for the kmfilteraction.cpp problem, i think the problem is in kdelibs/include/threadweaver/DebuggingAids.h the line #define debug( x, ...) should be replace by a void inline inline void debug( int severity, const char * format, ... ) {} otherwise i think the preprocessor only replace define by void thus leaving a Threadweaver::; in place of ThreadWeaver::debug( ... ); Not completly sure as i'm only a pure (you would perhaps say simple) "c" guy :))
*** Bug 154505 has been marked as a duplicate of this bug. ***
Created attachment 22662 [details] proposed modification for kdebug.h Tested OK with kdebase/kdepim compiling in release mode
Many progress has been made : - kdebase now compiled fine (thanks to SVN commit 752030 ) - kdesdk build fine (thanks to SVN commit 752104 by kkofler ) - kdepim is in better shape (thanks to SVN commit702562 and 752060 by tmcguire ) still a little problem in kleopatra/certificatewizardimpl.cpp s = kDebug() style The modification is very tiny and made the code more readable .... That's the last one i saw, think i have compile the entire KDE4 in release mode Thanks you all for your work ( and also to all participants Rolf Eike Beer, Pino toscano )
to add a comment on my own comment #9 which is as not informative as it's possible : the change i made in kdebug.h should not change anything functionality wise but to my eyes it improve the readability of the file The first inline function kDebug and kWarning is as far as i can see only use for kd3 support (all others should be catch by final kDebug/kWarning define and remap to KDebug class) . So i have marked them as kCompatDebug/kCompatWarning ... So this keep the deprecated warning for this function but isolate the reammping to debug function kDebug, kWarning, kFatal and kError use the same mechanism ( KDebug class ) for all new code. kFatal and kError could not be strapped as before. Must be verify by someone who has knowledge of this piece of code (i could have broke everything...) but i think that it improve the symmetry of all the functions used, so simplify their understanding for others. So maybe this "draft" could be of some help
Closing since this is an old compile issue. Please feel free to reopen if the issue is still relevant now.