RFR: 8299973: Replace NULL with nullptr in share/utilities/ [v3]

David Holmes dholmes at openjdk.org
Thu Jan 19 09:32:44 UTC 2023


On Thu, 19 Jan 2023 09:10:25 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Do the conversion in the share/utilities sub-directory and all of its files.
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix incorrect copyrights, reverts change in file that was only comment

A few suggestions about nullptr -> null (only suggestions)

Some unchanged files need their copyrights restored.

The AIX changes need reverting.

Thanks.

src/hotspot/share/utilities/compilerWarnings.hpp line 2:

> 1: /*
> 2:  * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.

No changes have been made to this file.

src/hotspot/share/utilities/compilerWarnings_gcc.hpp line 2:

> 1: /*
> 2:  * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.

No changes have been made to this file.

src/hotspot/share/utilities/copy.cpp line 71:

> 69:   static void conjoint_swap_if_needed(const void* src, void* dst, size_t byte_count, size_t elem_size) {
> 70:     assert(src != nullptr, "address must not be nullptr");
> 71:     assert(dst != nullptr, "address must not be nullptr");

I think "null" is more appropriate in assertion messages like this.

src/hotspot/share/utilities/debug.cpp line 488:

> 486:   FlagSetting fl(DisplayVMOutput, true);
> 487:   if (p == nullptr) {
> 488:     tty->print_cr("nullptr");

Ditto: "null"

src/hotspot/share/utilities/globalDefinitions_gcc.hpp line 142:

> 140: 
> 141: // gcc warns about applying offsetof() to non-POD object or calculating
> 142: // offset directly when base address is nullptr. The -Wno-invalid-offsetof

Again I prefer "null"

src/hotspot/share/utilities/globalDefinitions_xlc.hpp line 78:

> 76: // Some platform/tool-chain combinations can't assign NULL to an integer
> 77: // type so we define NULL_WORD to use in those contexts. For xlc they are the same.
> 78: #define NULL_WORD  nullptr

Hmmm so maybe NULL_WORD can be retired after this change?

src/hotspot/share/utilities/json.hpp line 2:

> 1: /*
> 2:  * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.

There are no changes in this file.

src/hotspot/share/utilities/linkedlist.hpp line 305:

> 303: 
> 304:   virtual bool remove_before(LinkedListNode<E>* ref) {
> 305:     assert(ref != nullptr, "nullptr pointer");

null pointer (though it's a poor message anyway)

src/hotspot/share/utilities/vmError.hpp line 190:

> 188:   DEBUG_ONLY(static void controlled_crash(int how);)
> 189: 
> 190:   // Non-nullptr address guaranteed to generate a SEGV mapping error on read, for test purposes.

Non-null

-------------

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12015


More information about the hotspot-dev mailing list