Review Request 113189: lower (a lot) warning noise caused by undefined macros

Andrea Iacovitti aiacovitti at libero.it
Tue Dec 10 18:41:35 GMT 2013



> On Oct. 10, 2013, 11:59 a.m., Bernd Buschinski wrote:
> > This is a bit confussing...
> > 
> > lets sum up the background story:
> > - kjs(/wtf) loves gcc features
> > - kjs-cmake filters out (gcc) pedantic
> > 
> > now comes the problem... whats with other compilers?
> > 
> > if you look at the commit message that caused the warnings:
> > 
> > "According to CPP standards (defined(X) && X) should be the same of just (X). On the other hand it is undefined behavior if 'defined' appears in a macro expansion. gcc -pedantic and icl evaluates them always to false."
> > ( http://quickgit.kde.org/?p=kdelibs.git&a=commit&h=75fa90c16232186bbd287a2ac79839ea34da32c4 )
> > 
> > -> "it is undefined behavior if 'defined' appears in a macro expansion" <-
> > 
> > So? Whats the correct solution here?
> > And yes, I agree the warnings ARE annoying.
> > 
> > But I would like to hear a second opinion here :)
> 
> Michael Pyne wrote:
>     IIRC when I was trying to filter out these warnings to debug some Clang issues, the define flags in question are always non-zero if they are defined at all. So it might be possible to replace #if with #ifdef instead.
> 
> Jiří Pinkava wrote:
>     The other option is add something like
>     
>     #if !defined(SOMETHING)
>     #define SOMETHING 0
>     #endif
>     
>     this is common pattern in other (non-kde) projects.

It appears the same patch has been already applied to KDE/4.12 branch:
http://commits.kde.org/kdelibs/96cde24b38765bcc96d0efe462bd8c2f950ab47f


- Andrea


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113189/#review41489
-----------------------------------------------------------


On Oct. 10, 2013, 10:52 a.m., Jiří Pinkava wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/113189/
> -----------------------------------------------------------
> 
> (Updated Oct. 10, 2013, 10:52 a.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> There is a lot of warning noise in kdelibs build, this decreases number of warnings a lot.
> 
> I have 'git grep'ped the code and checked all usages, and found no problem.
> 
> Tested by compile/usage. 
> 
> 
> Diffs
> -----
> 
>   kjs/wtf/Platform.h 843cfd2 
> 
> Diff: http://git.reviewboard.kde.org/r/113189/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jiří Pinkava
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20131210/fecc2cb4/attachment.htm>


More information about the kde-core-devel mailing list