[jdk11u-dev] RFR: 8224087: Compile C code for at least C99 Standard compliance
Andrew John Hughes
andrew at openjdk.org
Thu Sep 18 23:21:12 UTC 2025
On Wed, 3 Sep 2025 11:23:31 GMT, Zdenek Zambersky <zzambers at openjdk.org> wrote:
> This backport explicitly sets c99 standard for jdk c sources on compilers, where appropriate. Motivation for this is, [recent gcc switch to c23 as default](https://www.phoronix.com/news/GCC-15-Default-C23), causing errors (jdk sources are not c23 compatible).
>
> Main problem is, that c23 no longer supports non-prototype function declarations (see (3) [here](https://en.cppreference.com/w/c/language/function_declaration.html)). Example errors:
>
> /mnt/ramdisk/java-11-openjdk-11.0.28.0.6-1.portable.jdk.el.x86_64.tarxz/src/src/java.base/unix/native/libnet/DefaultProxySelector.c:389:16: error: too many arguments to function 'g_proxy_resolver_lookup'; expected 0, have 4
> 389 | proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error);
> | ~^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
>
>
>
> /mnt/ramdisk/java-11-openjdk-11.0.28.0.6-1.portable.jdk.el.x86_64.tarxz/src/test/hotspot/jtreg/runtime/jsig/libTestJNI.c:45:22: error: assignment to 'void (*)(int, siginfo_t *, void *)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
> 45 | act.sa_sigaction = (void (*)())sig_handler;
> | ^
>
>
> There are more, if above are fixed. Non prototype function declarations are present even in newest jdk, but newer jdks have c standard set explicitly, so they do not cause errors there.
>
> This should not increase minimum requirements for compiler toolchains needed to build jdk11. [Jdk13](https://github.com/openjdk/jdk13/blob/master/doc/building.md#native-compiler-toolchain-requirements), where this originates from, has same minimal compiler requirements as [jdk11](https://github.com/zzambers/jdk11u-dev/blob/master/doc/building.md#native-compiler-toolchain-requirements). ( gcc 4.8, clang 3.2, Xcode 8, Solaris Studio 12.4)
Thanks. My main concern was less what is claimed to be supported and more what people are actively building on at present. In particular, I'm reassured that it still builds on RHEL 7 as that's the one of most importance to us and where I test each build promotion.
I think the Solaris change, while untested, should be safe as it essentially just widens the scope of the existing usage from awt to the whole library build. My concern was the new option.
I think this is good to go in and should then get plenty of testing before January's release.
-------------
Marked as reviewed by andrew (Reviewer).
PR Review: https://git.openjdk.org/jdk11u-dev/pull/3087#pullrequestreview-3242326723
More information about the jdk-updates-dev
mailing list