RFR: 8299974: Replace NULL with nullptr in share/adlc/
Vladimir Kozlov
kvn at openjdk.org
Wed May 24 19:19:09 UTC 2023
On Tue, 16 May 2023 11:54:20 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/adlc. 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!
I have few comments
src/hotspot/share/adlc/adlparse.cpp line 4595:
> 4593:
> 4594: if( _curline == nullptr ) // Return null at EOF.
> 4595: return nullptr;
Spacing of comment. Please, fix code style to:
if (_curline == nullptr) { // Return null at EOF.
return nullptr;
}
src/hotspot/share/adlc/adlparse.cpp line 4627:
> 4625:
> 4626: // Make sure we do not try to use #defined identifiers. If start is
> 4627: // null an error was already reported.
May be use `nullptr` here since we are talking about value in `start` variable.
src/hotspot/share/adlc/adlparse.cpp line 4795:
> 4793:
> 4794: if( _curline == nullptr ) // Return null at EOF.
> 4795: return 0;
Code style.
src/hotspot/share/adlc/adlparse.cpp line 4830:
> 4828:
> 4829: if( _curline == nullptr ) // Return null at EOF.
> 4830: return nullptr;
Code style.
src/hotspot/share/adlc/adlparse.cpp line 5242:
> 5240: }
> 5241: if( _curline != nullptr ) // at end of file _curchar isn't valid
> 5242: _curchar = *_ptr; // reset _curchar to maintain invariant
Code style.
-------------
PR Review: https://git.openjdk.org/jdk/pull/14008#pullrequestreview-1442573130
PR Review Comment: https://git.openjdk.org/jdk/pull/14008#discussion_r1204642438
PR Review Comment: https://git.openjdk.org/jdk/pull/14008#discussion_r1204644334
PR Review Comment: https://git.openjdk.org/jdk/pull/14008#discussion_r1204645287
PR Review Comment: https://git.openjdk.org/jdk/pull/14008#discussion_r1204645560
PR Review Comment: https://git.openjdk.org/jdk/pull/14008#discussion_r1204646229
More information about the hotspot-compiler-dev
mailing list