RFR: 8357563: Shenandoah headers leak un-prefixed defines

Aleksey Shipilev shade at openjdk.org
Thu May 22 14:56:54 UTC 2025


On Thu, 22 May 2025 12:36:07 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> We hit a compilation error in ZGC when we defined a constant NumPartitions. This happened because there is a define name NumPartitions inside shenandoahFreeSet.hpp. I propose that this (and its friends) are hid inside the ShenandoahRegionPartitions class, which is the only user of these defines. An alternative would be to prefix the define with something that is unlikely to clash with other parts of HotSpot.
> 
> This PR is my suggestion for a change to solve this so this name conflict. Does this seem like an acceptable solution, or do you want something else? Thanks!

Yes, this is fine. These should never have been in global scope, especially in the header that can easily be transitively included.

Actually, I would question even the type-casted triad, and probably a single constant would instead do. Leave it to a follow-up, if present problem blocks current development.

@kdnilsen @earthling-amzn ^

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

Marked as reviewed by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25392#pullrequestreview-2861568514
PR Comment: https://git.openjdk.org/jdk/pull/25392#issuecomment-2901536748


More information about the hotspot-gc-dev mailing list