RFR: 8214976: Warn about uses of functions replaced for portability
Kim Barrett
kbarrett at openjdk.java.net
Fri Jan 28 23:06:06 UTC 2022
On Fri, 28 Jan 2022 05:08:57 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Shouldn't we generate a warning for all external functions for which there is an os:: replacement e.g. pread is called by read_at; gethostbyname is called by get_host_by_name; ...
>
> Thanks, David
That seems like a good goal, but I don't think we have to get complete coverage in one PR.
> src/hotspot/os/aix/os_aix.cpp line 2499:
>
>> 2497: struct dirent *ptr;
>> 2498:
>> 2499: dir = os::opendir(path);
>
> Just to clarify, as we are in the scope of the os class both `opendir` and `os::opendir` are the same thing here - and similarly for other code in the os class - right?
Yes, that's correct. So an unqualified opendir here should not trigger a forbidden warning.
> src/hotspot/share/utilities/compilerWarnings_gcc.hpp line 80:
>
>> 78: #define NULL 0
>> 79: #endif
>> 80: #endif
>
> This is really ugly just because we include dirent.h so we can add the warning for a few functions; and even uglier because it is only needed for AIX, and even uglier still because based on the existing code we only compile AIX with xlc - no? Otherwise we would already need this hack for gcc.
We only compile AIX with xclang these days. I don't know how our "xlc" compiler platform mechanism interacts with our "gcc" (which is really both gcc and clang) compiler platform, or if it interacts, or if it should. But none of that matters for the dirent.h problem. The problem there is that it's a system header, irrespective of what compiler is being used, and it has this problem. So whether we need this NULL cruft here depends on whether AIX with xclang uses this file or not. One option would be to just not deal with the dirent stuff yet, saving that for a followup focused on that problem.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7248
More information about the hotspot-dev
mailing list