this-pointer NULL-checks in hotspot codebase [-Wtautological-undefined-compare]
Baesken, Matthias
matthias.baesken at sap.com
Fri Jul 12 07:48:32 UTC 2019
Hello , when looking into the recent xlc16 / xlclang warnings I came across those 3 :
/nightly/jdk/src/hotspot/share/adlc/formssel.cpp:1729:7: warning: 'this' pointer cannot be null in well-defined C++ code;
comparison may be assumed to always evaluate to true [-Wtautological-undefined-compare]
if( this != NULL ) {
^~~~ ~~~~
/nightly/jdk/src/hotspot/share/adlc/formssel.cpp:3416:7: warning: 'this' pointer cannot be null in well-defined C++ code;
comparison may be assumed to always evaluate to false [-Wtautological-undefined-compare]
if( this == NULL ) return;
/nightly/jdk/src/hotspot/share/libadt/set.cpp:46:7: warning: 'this' pointer cannot be null in well-defined C++ code;
comparison may be assumed to always evaluate to false [-Wtautological-undefined-compare]
if( this == NULL ) return os::strdup("{no set}");
Do you think the NULL-checks can be removed or is there still some value in doing them ?
Best regards, Matthias
More information about the hotspot-dev
mailing list