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

Dean Long dlong at openjdk.org
Fri Aug 11 00:16:28 UTC 2023


On Thu, 10 Aug 2023 22:52:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change fixes various -Wconversion warnings from files in the os directories and related, widening types or adding checked_cast<> where narrowing.
>> Tested with tier1 on linux/macosx/windows and tier1-4 on linux-x64-debug, windows-x64-debug.
>
> Coleen Phillimore has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
> 
>  - Dean's suggested changes.
>  - Merge branch 'master' into os-conversion
>  - Fix cgroupSubsystem_linux.cpp
>  - Unset Wconversion for testing.
>  - Fix signals to take int buflen, fixed return types of syscalls
>  - Fix attachListener.cpp warnings.
>  - change send/recv parameter type to match OS.
>  - Fix -Wconversion warnings in os_linux.

src/hotspot/share/runtime/os.hpp line 781:

> 779:   static void print_siginfo(outputStream* st, const void* siginfo);
> 780:   static void print_signal_handlers(outputStream* st, char* buf, int buflen);
> 781:   static void print_date_and_time(outputStream* st, char* buf, size_t buflen);

I understand you are trying to minimize changes, but these functions all used size_t consistently.  It seems odd to change the type of just this one function.

src/hotspot/share/utilities/decoder_elf.cpp line 70:

> 68:   filepath[JVM_MAXPATHLEN - 1] = '\0';
> 69:   int offset_in_library = -1;
> 70:   if (!os::dll_address_to_library_name(pc, filepath, (int)sizeof(filepath), &offset_in_library)) {

How about fixing dll_address_to_library_name to use size_t like all the rest of the os:: functions?

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

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


More information about the hotspot-dev mailing list