RFR: JDK-8308288: Fix xlc17 clang warnings in shared code

JoKern65 duke at openjdk.org
Thu May 25 16:16:57 UTC 2023


On Thu, 25 May 2023 15:18:41 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> When using the new xlc17 compiler (based on a recent clang) to build OpenJDk on AIX , we run into various "warnings as errors".
>> Some of those are in shared codebase and could be addressed by small adjustments.
>> A lot of those changes are in hotspot, some might be somewhere else in the OpenJDK C/C++ code.
>
> test/jdk/java/io/File/libGetXSpace.c line 128:
> 
>> 126: #else
>> 127:     struct statfs buf;
>> 128:     int result = statfs((char*)chars, &buf);
> 
> Is this working around a bug in IBM's declaration?
> 
> Also, pre-existing, the cast seems really suspicious.  The type of `chars` is `jchar*`, which is a
> sequence of 16bit characters.  Does this actually work?  If so, how?

This is IBMs declaration of statfs
`extern int statfs(char *, struct statfs *);`
So the compiler will not accept a `const char*`
Indeed I do not know if this ever worked, but my change makes it not worse.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14146#discussion_r1205745144


More information about the hotspot-dev mailing list