RFR: 8374445: Fix -Wzero-as-null-pointer-constant warnings in JfrSet [v2]

Kim Barrett kbarrett at openjdk.org
Thu Jan 15 16:50:14 UTC 2026


> Please review this change to fix JfrSet to avoid triggering
> -Wzero-as-null-pointer-constant warnings when that warning is enabled.
> 
> The old code uses an entry value with representation 0 to indicate the entry
> doesn't have a value. It compares an entry value against literal 0 to check
> for that. If the key type is a pointer type, this involves an implicit 0 =>
> null pointer constant conversion, so we get a warning when that warning is
> enabled.
> 
> Instead we initialize entry values to a value-initialized key, and compare
> against a value-initialized key. This changes the (currently undocumented)
> requirements on the key type. The key type is no longer required to be
> trivially constructible (to permit memset-based initialization), but is now
> required to be value-initializable. That's currently a wash, since all of the
> in-use key types are fundamental types (traceid (u8) and Klass*).
> 
> Testing: mach5 tier1-3 (tier3 is where most jfr tests are run)

Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:

 - Merge branch 'master' into jfrset-zero-as-null-pointer-warnings
 - fix -Wzero-as-null-poniter-constant warnings in jfrSet.hpp

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29022/files
  - new: https://git.openjdk.org/jdk/pull/29022/files/d2ee55ab..d54334e0

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29022&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29022&range=00-01

  Stats: 55051 lines in 1117 files changed: 27415 ins; 10797 del; 16839 mod
  Patch: https://git.openjdk.org/jdk/pull/29022.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29022/head:pull/29022

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


More information about the hotspot-jfr-dev mailing list