[jdk8u-dev] RFR: 8315506: C99 compatibility issue in LinuxNativeDispatcher

Andrew John Hughes andrew at openjdk.org
Fri Sep 1 13:02:43 UTC 2023


On Fri, 1 Sep 2023 10:12:18 GMT, Florian Weimer <fweimer at openjdk.org> wrote:

> The `Java_sun_nio_fs_LinuxNativeDispatcher_getlinelen` function calls the `free` function without including `<stdlib.h>`. This results in an implicit function declarations, and some compilers no longer support that by default, leading to a build failure.
> 
> Per the comment in the file, this function was introduced in the backport from jdk11, so this bug is specific to jdk8u.
> 
> Patch originally submitted by @djdelorie as openjdk/jdk8u#42.
> 
> Related to:
> 
> * https://fedoraproject.org/wiki/Changes/PortingToModernC
> * https://fedoraproject.org/wiki/Toolchain/PortingToModernC

The function that introduces the `free` was added in `UnixNativeDispatcher.c` on 11u, which had a `stdlib.h` import since creation. As mentioned on the bug report, it was moved to `LinuxNativeDispatcher.c` in the backport of [JDK-8229872](https://bugs.openjdk.org/browse/JDK-8229872) to 8u, so this is 8u-specific.

Patch looks ok for 8u. Please run the GHA tests and then add `jdk8u-fix-request` to the bug, with a note on why this should be included.

Out of interest, what flags are you building with to make this a build failure? I've not seen that when building 8u. I don't believe this code is built with `-Werror` by default.

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

Marked as reviewed by andrew (Reviewer).

PR Review: https://git.openjdk.org/jdk8u-dev/pull/362#pullrequestreview-1606899972
PR Comment: https://git.openjdk.org/jdk8u-dev/pull/362#issuecomment-1702711595


More information about the jdk8u-dev mailing list