Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8343802

Prevent NULL usage backsliding

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot
    • 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
      See JDK-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++.

            nbenalla Nizar Benalla
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: