RFR: 8313552: Fix -Wconversion warnings in JFR code

Markus Grönlund mgronlun at openjdk.org
Fri Aug 4 15:22:32 UTC 2023


On Fri, 4 Aug 2023 15:07:09 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Greetings,
>> 
>> this change set removes -Wconversion warnings in the JFR code.
>> 
>> Testing: jdk_jfr
>> 
>> Thanks
>> Markus
>
> src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp line 914:
> 
>> 912:   u4 stack_map_attrib_len = writer.current_offset() - stack_map_attrib_len_offset;
>> 913:   // the stack_map_table_attributes_length value is exclusive
>> 914:   stack_map_attrib_len -= sizeof(u4);
> 
> I'm thinking we should have globalDefinitions.hpp:
> 
> 
>   const int u4_size = (int)sizeof(u4);
>   const int u2_size = (int)sizeof(u2);
>   const int u1_size = (int)sizeof(u1);
> 
> 
> I don't think you have to static_cast<u4>(4) here.  It looks bad here.

Since 4 is an int by default, the cast is needed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15152#discussion_r1284554153


More information about the hotspot-jfr-dev mailing list