-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
The HotSpot style guide says nullptr should be used, rather than NULL. A series of changes were made to eliminate uses of NULL in HotSpot, along with some followups to fix backsliding. It would be helpful to have the build system prevent the introduction of new uses of NULL.
Currently a sufficient mechanism could be built using
egrep "[^[:alnum:]_]NULL([^[:alnum:]_]|$)"
on {src,test}/hotspot, filtering out some hits, and checking for any residue.
If there are files remaining, report them and fail to build.
In hotspot/src, filter out the following files:
src/hotspot/share/prims/jvmti.xml
src/hotspot/share/prims/jvmti.xsl
These files contain code snippets used to generate C code, not C++.
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
src/hotspot/share/utilities/globalDefinitions_gcc.hpp
See JDK-8324686 and JDK-8343800.
In hotspot/test, filter out all .c and .java files. In addition, filter out the following files:
test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp
SeeJDK-8343801.
test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
These files contain sample C code, not C++.
Currently a sufficient mechanism could be built using
egrep "[^[:alnum:]_]NULL([^[:alnum:]_]|$)"
on {src,test}/hotspot, filtering out some hits, and checking for any residue.
If there are files remaining, report them and fail to build.
In hotspot/src, filter out the following files:
src/hotspot/share/prims/jvmti.xml
src/hotspot/share/prims/jvmti.xsl
These files contain code snippets used to generate C code, not C++.
src/hotspot/share/utilities/globalDefinitions_visCPP.hpp
src/hotspot/share/utilities/globalDefinitions_gcc.hpp
See JDK-8324686 and JDK-8343800.
In hotspot/test, filter out all .c and .java files. In addition, filter out the following files:
test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp
See
test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
test/hotspot/jtreg/vmTestbase/nsk/share/jni/README
These files contain sample C code, not C++.
- relates to
-
JDK-8342860 Fix more NULL usage backsliding
- Resolved
-
JDK-8324686 Remove redefinition of NULL for MSVC
- Open
-
JDK-8332189 Enable -Wzero-as-null-pointer-constant
- Open
-
JDK-8343800 Cleanup definition of NULL_WORD
- Open
-
JDK-8343801 Change string printed by nsk_null_string for null strings
- Resolved