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

Dean Long dlong at openjdk.org
Mon Aug 14 21:27:56 UTC 2023


On Mon, 14 Aug 2023 21:07:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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) {
>       |       ~~~~~~~~^~~~~~~~~~~

Sorry, I thought ebuflen was size_t.

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

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


More information about the hotspot-dev mailing list