RFR: 8214976: Warn about uses of functions replaced for portability [v2]
David Holmes
dholmes at openjdk.java.net
Wed Feb 2 00:13:12 UTC 2022
On Tue, 1 Feb 2022 14:08:40 GMT, Harold Seigel <hseigel at openjdk.org> wrote:
>> src/hotspot/share/utilities/compilerWarnings_gcc.hpp line 97:
>>
>>> 95: FORBID_C_FUNCTION(FILE* fopen(const char*, const char*), "use os::fopen");
>>> 96: FORBID_C_FUNCTION(int fsync(int), "use os::fsync");
>>> 97: FORBID_C_FUNCTION(int ftruncate(int, off_t), "use os::ftruncate");
>>
>> Shouldn't this be ftruncate for BSD and ftruncate64 for other Posix (not sure what Windows has)?
>
> Platform agnostic code would call ftruncate(), not ftruncate64(). So I think this is correct as is.
You need to enable the warning for the function that we would use, which we are not supposed to use and that would be `ftruncate64` on Linux.
>> src/hotspot/share/utilities/compilerWarnings_gcc.hpp line 99:
>>
>>> 97: FORBID_C_FUNCTION(int ftruncate(int, off_t), "use os::ftruncate");
>>> 98: FORBID_C_FUNCTION(void funlockfile(FILE *), "use os::funlockfile");
>>> 99: FORBID_C_FUNCTION(off_t lseek(int, off_t, int), "use os::lseek");
>>
>> Similarly there should be a lseek64 definition too.
>
> Like ftruncate(), platform agnostic code would call lseek(), not lseek64(). So I think this is correct as is.
I disagree - you are not enabling the warnings for all the functions that would be used.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7248
More information about the hotspot-dev
mailing list