RFR: 8214976: Warn about uses of functions replaced for portability [v3]
Harold Seigel
hseigel at openjdk.java.net
Wed Jan 12 16:36:49 UTC 2022
> Please review this change for JDK-8214976. This change adds attribute warnings to header file compilerWarnings.hpp so that compilation warnings get issued when certain system functions are called directly, instead of hotspot's os:: versions of the functions. Many additional files were changed because of compilation warnings resulting from the compilerWarnings.hpp changes.
>
> A sample warning is:
>
> .../open/test/hotspot/gtest/logging/test_log.cpp:63:19: error: call to 'fopen' declared with attribute warning: use os::fopen [-Werror=attribute-warning]
> 63 | FILE* fp = fopen(TestLogFileName, "r");
> | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
>
>
> Note that changing src/hotspot/os/linux/gc/z/zMountPoint_linux.cpp to call os:: functions requires adding "#include "runtime/os.hpp" and caused test gc/z/TestAllocateHeapAt.java to fail. So, for now, I just added PRAGMA_PERMIT_FORBIDDEN_C_FUNCTION to zMountPoint_linux.cpp. There's a similar issue with gtest/logging/test_logDecorators.cpp.
>
> Attribute warnings for additional functions, such as malloc(), were not included in this change because they require lots of source code changes.
>
> This change was tested by running mach5 tiers 1-2 on Linux, Mac OS, and Windows, Mach5 tiers 3-5 on Linux x64. Also, builds were done on Linux-zero, Linux-s390, and Linux-ppc.
>
> Thanks, Harold
Harold Seigel has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
- more stuff
- revert strdup() changes and address some of Kim's comments
- 8214976: Warn about uses of functions replaced for portability
- rebase attempt 2
- rebase
-------------
Changes: https://git.openjdk.java.net/jdk/pull/6961/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6961&range=02
Stats: 158 lines in 26 files changed: 73 ins; 1 del; 84 mod
Patch: https://git.openjdk.java.net/jdk/pull/6961.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6961/head:pull/6961
PR: https://git.openjdk.java.net/jdk/pull/6961
More information about the hotspot-dev
mailing list