RFR: JDK-8301481: Replace NULL with nullptr in os/windows
Johan Sjölen
jsjolen at openjdk.org
Tue Jan 31 11:39:55 UTC 2023
On Tue, 31 Jan 2023 10:16:14 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory os/windows. 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 that need fixing
src/hotspot/os/windows/gc/z/zMapper_windows.cpp line 69:
> 67: MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, // AllocationType
> 68: PAGE_NOACCESS, // PageProtection
> 69: nullptr, // ExtendedParameters
Align
src/hotspot/os/windows/gc/z/zMapper_windows.cpp line 104:
> 102: HANDLE const res = ZSyscall::CreateFileMappingW(
> 103: INVALID_HANDLE_VALUE, // hFile
> 104: NULL, // lpFileMappingAttribute
Align
src/hotspot/os/windows/gc/z/zMapper_windows.cpp line 136:
> 134: file_handle, // FileMapping
> 135: GetCurrentProcess(), // ProcessHandle
> 136: nullptr, // BaseAddress
Align
src/hotspot/os/windows/gc/z/zMapper_windows.cpp line 141:
> 139: 0, // AllocationType
> 140: PAGE_NOACCESS, // PageProtection
> 141: nullptr, // ExtendedParameters
Align
src/hotspot/os/windows/gc/z/zMapper_windows.cpp line 168:
> 166: MEM_COMMIT, // AllocationType
> 167: PAGE_NOACCESS, // PageProtection
> 168: nullptr, // ExtendedParameters
Align
src/hotspot/os/windows/os_perf_windows.cpp line 674:
> 672: *
> 673: * @param pdh_artifact_idx the counter index as specified in the registry
> 674: * @return localized pdh artifact string if successful, nullptr on failure.
null
src/hotspot/os/windows/os_perf_windows.cpp line 694:
> 692: * Caller needs ResourceMark.
> 693: *
> 694: * @return the process image string description, nullptr if the call failed.
null
src/hotspot/os/windows/os_perf_windows.cpp line 787:
> 785: * Caller needs ResourceMark;
> 786: *
> 787: * @return buffer if successful, nullptr on failure.
null
src/hotspot/os/windows/os_perf_windows.cpp line 804:
> 802: nullptr, // instance buffer is null and
> 803: &i_size, // pass 0 length in order to get the required size
> 804: PERF_DETAIL_WIZARD, // counter detail level
check align
src/hotspot/os/windows/os_perf_windows.cpp line 820:
> 818: PERF_DETAIL_WIZARD, // counter detail level
> 819: 0);
> 820: return PdhDll::PdhStatusFail(pdhStat) ? nullptr : instances;
align
src/hotspot/os/windows/windbghelp.cpp line 296:
> 294: }
> 295:
> 296: FOR_ALL_FUNCTIONS(CHECK_AND_PRINT_IF_NULL)
fix
-------------
PR: https://git.openjdk.org/jdk/pull/12317
More information about the hotspot-dev
mailing list