RFR: 8337418: Fix -Wzero-as-null-pointer-constant warnings in prims code

David Holmes dholmes at openjdk.org
Tue Jul 30 05:32:32 UTC 2024


On Tue, 30 Jul 2024 04:12:33 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change that removes some uses of literal 0 as a null
> pointer constant in prims code.
> 
> Testing: mach5 tier1

Couple of queries on this one.

Thanks

src/hotspot/share/prims/jni.cpp line 1151:

> 1149: \
> 1150:   EntryProbe; \
> 1151:   ResultType ret{}; \

This looks bogus. ResultType is just a macro variable and could be a primitive type. ?? Does the local need initializing?

src/hotspot/share/prims/methodHandles.cpp line 439:

> 437:   default:
> 438:     fatal("unexpected intrinsic id: %d %s", vmIntrinsics::as_int(iid), vmIntrinsics::name_at(iid));
> 439:     return 0;

Do we no longer need these returns after `fatal` to keep compilers happy?

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

PR Review: https://git.openjdk.org/jdk/pull/20385#pullrequestreview-2206671959
PR Review Comment: https://git.openjdk.org/jdk/pull/20385#discussion_r1696328696
PR Review Comment: https://git.openjdk.org/jdk/pull/20385#discussion_r1696329565


More information about the serviceability-dev mailing list