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

Coleen Phillimore coleenp at openjdk.org
Fri Aug 11 13:31:02 UTC 2023


On Fri, 11 Aug 2023 12:22:19 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/os/posix/os_posix.cpp line 92:
>> 
>>> 90: static jlong initial_time_count = 0;
>>> 91: 
>>> 92: static int64_t clock_tics_per_sec = 100;
>> 
>> why do we need to do this? It would get promoted in any expression using 64-bit variables
>
> src/hotspot/os/posix/os_posix.cpp:1211:31: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
>  1211 |   clock_tics_per_sec = sysconf(_SC_CLK_TCK);
>       |                        ~~~~~~~^~~~~~~~~~~~~

Although I did the opposite for the linux version (ie casted the result of sysconf instead).

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

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


More information about the hotspot-dev mailing list