8374445: Fix -Wzero-as-null-pointer-constant warnings in JfrSet #29022
+10
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29022/head:pull/29022$ git checkout pull/29022Update a local copy of the PR:
$ git checkout pull/29022$ git pull https://git.openjdk.org/jdk.git pull/29022/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 29022View PR using the GUI difftool:
$ git pr show -t 29022Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29022.diff
Using Webrev
Link to Webrev Comment