RFR: 8336080: Fix -Wzero-as-null-pointer-constant warnings in ClassLoaderStats ctor
David Holmes
dholmes at openjdk.org
Tue Jul 16 05:56:51 UTC 2024
On Thu, 11 Jul 2024 12:31:21 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/classfile/classLoaderStats.hpp line 87:
>>
>>> 85: _cld(nullptr),
>>> 86: _class_loader(),
>>> 87: _parent(),
>>
>> Why are these not initialized with `nullptr` given we have code like:
>>
>> (cls._class_loader == nullptr ? ...)
>>
>> ?
>
> It would work to do so, though I kind of wish otherwise.
>
> I wish one wrote
>
> (cls._class_loader == oop() ? ...)
>
> and
>
> _class_loader = oop();
>
> instead of
>
> _class_loader = nullptr;
>
> but I think that ship sailed a long time ago. Instead we have some really questionable conversions
> available in the (debug-only) oop class. Maybe we can trim those down a bit now that we consistently
> use nullptr and can use std::nullptr_t as an overload type. Maybe I'll take a look at that sometime.
Sorry missed this update. Thanks for explanation. I'm okay with things as they stand here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20109#discussion_r1678796641
More information about the hotspot-runtime-dev
mailing list