RFR: 8275004: CDS build failure with gcc11 [v2]
jiefu at openjdk.java.net
Sun Oct 10 11:33:31 UTC 2021
On Sun, 10 Oct 2021 10:48:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> > I think `<cstddef>` is enough since the failure was caused by undefined `size_t`. Why `globalDefinitions.hpp` is better here?
> I believe it is a good style to avoid including standard headers directly.
> While Hotspot Style Guide [permits](https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md#c-standard-library) using `cstddef` directly for `std::nullptr_t`, it does not directly allow it for `size_t` (if we follow this rule exactly). Moreover, it suggests to use a hotspot header even for the allowed cases. There is the only case of `std::nullptr_t` use in `oopsHierarchy.hpp`, and it still includes `cstddef` through `globalDefinitions.hpp`. Therefore it is reasonable to do the same here.
> (Also, includes should be in alphabetic order, if you change it).
Thanks for your explanation.
More information about the hotspot-runtime-dev