RFR: JDK-8301479: Replace NULL with nullptr in os/linux
Johan Sjölen
jsjolen at openjdk.org
Tue Jan 31 10:43:39 UTC 2023
On Tue, 31 Jan 2023 10:15:48 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory os/linux. Unfortunately the script that does the change isn't perfect, and so we
> need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
>
> Here are some typical things to look out for:
>
> 1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
> 2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
> 3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in a comment.
>
> An example of this:
>
> ```c++
> // This function returns null
> void* ret_null();
> // This function returns true if *x == nullptr
> bool is_nullptr(void** x);
>
>
> Note how `nullptr` participates in a code expression here, we really are talking about the specific value `nullptr`.
>
> Thanks!
Found some things to fix
src/hotspot/os/linux/cgroupSubsystem_linux.hpp line 169:
> 167: err = subsystem_file_line_contents(subsystem, \
> 168: filename, \
> 169: nullptr, \
Align
src/hotspot/os/linux/cgroupSubsystem_linux.hpp line 187:
> 185: err = subsystem_file_line_contents(subsystem, \
> 186: filename, \
> 187: nullptr, \
Align
src/hotspot/os/linux/cgroupSubsystem_linux.hpp line 191:
> 189: variable); \
> 190: if (err != 0) \
> 191: return (return_type) nullptr; \
Align
src/hotspot/os/linux/os_linux.cpp line 2177:
> 2175:
> 2176: p = OSContainer::cpu_cpuset_memory_nodes();
> 2177: st->print_cr("cpu_memory_nodes: %s", p != null ? p : "not supported");
Glitched out
src/hotspot/os/linux/os_linux.cpp line 3312:
> 3310:
> 3311: // Allocate (using mmap, NO_RESERVE, with small pages) at either a given request address
> 3312: // (req_addr != null) or with a given alignment.
nullptr
src/hotspot/os/linux/os_linux.cpp line 3840:
> 3838:
> 3839: // Since shmid has been setup with SHM_HUGETLB, shmat will automatically
> 3840: // return large page size aligned memory addresses when req_addr == null.
nullptr
-------------
PR: https://git.openjdk.org/jdk/pull/12315
More information about the hotspot-dev
mailing list