RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v7]

Coleen Phillimore coleenp at openjdk.org
Mon Aug 14 21:10:20 UTC 2023


On Mon, 14 Aug 2023 20:32:20 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use 'long' and fix -Wsign-compare warnings from previous edit.  Make max_len size_t in the three places.
>
> src/hotspot/os/linux/os_linux.cpp line 1608:
> 
>> 1606:     // No more space in ebuf for additional diagnostics message
>> 1607:     return nullptr;
>> 1608:   }
> 
> Suggestion:
> 
>   size_t ebuf_len = strlen(ebuf);
>   if (ebuflen <= ebuf_len) {
>     // No more space in ebuf for additional diagnostics message
>     return nullptr;
>   }
>   size_t diag_msg_max_length = ebuflen - ebuf_len;

/scratch/cphillim/hg/22os-conversion/src/hotspot/os/linux/os_linux.cpp:1605:15: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
 1605 |   if (ebuflen <= ebuf_len) {
      |       ~~~~~~~~^~~~~~~~~~~

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1293971628


More information about the hotspot-dev mailing list