Fwd: [Development] Are we free of code that checks this isn't null?

Kevin Funk kfunk at kde.org
Fri Mar 4 20:22:03 UTC 2016


On Friday, March 04, 2016 09:00:21 PM Milian Wolff wrote:
> On Freitag, 4. März 2016 10:51:08 CET Kevin Funk wrote:
> > Are *we* free of it?
> > 
> > Simply using this under Clang should tell us about all occurrences:
> >   -Werror=undefined-bool-conversion
> 
> I think that there where cases in the older code base and they broke with
> clang already and I fixed it. I'm not sure whether I found all of those
> though
> :)
> 
> I'll also take another look.

Not necessary I think.

I've build both kdevplatform + kdevelop with a change similar to this:

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=undefined-bool-conversion 
-Werror=tautological-undefined-compare")
endif()

=> No compile errors. => All fine I think.

I've asked the GCC guys, whether they have more info.

Question is: want me to commit above patch? I guess it makes sense 
nevertheless. See [1] [2] for what things trigger those warnings.

Cheers,
Kevin

[1] https://github.com/vgvassilev/clang/blob/master/test/SemaCXX/warn-tautological-undefined-compare.cpp
[2] https://github.com/vgvassilev/clang/blob/master/test/SemaCXX/warn-undefined-bool-conversion.cpp


> 
> Cheers
> 
> > ----------  Forwarded Message  ----------
> > 
> > Subject: [Development] Are we free of code that checks this isn't null?
> > Date: Thursday, March 03, 2016, 10:52:15 PM
> > From: Thiago Macieira <thiago.macieira at intel.com>
> > To: development at qt-project.org
> > 
> > Found in GCC 6's changelog (http://gcc.gnu.org/gcc-6/changes.html):
> > > Value range propagation now assumes that the this pointer of C++ member
> > > functions is non-null. This eliminates common null pointer checks but
> > > also
> > > breaks some non-conforming code-bases (such as Qt-5, Chromium,
> > > KDevelop).
> > > As a temporary work-around -fno-delete-null-pointer-checks can be used.
> > > Wrong code can be identified by using -fsanitize=undefined.
> > 
> > Are we free of such mistakes? Or do we need to enable -fno-delete-null-
> > pointer-checks?

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160304/8c79b329/attachment.sig>


More information about the KDevelop-devel mailing list