[jdk11u-dev] RFR: 8224087: Compile C code for at least C99 Standard compliance

Zdenek Zambersky zzambers at openjdk.org
Mon Sep 8 15:40:21 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)

Build logs:
[jdk-c99-logs.tar.gz](https://github.com/user-attachments/files/22214405/jdk-c99-logs.tar.gz)

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

PR Comment: https://git.openjdk.org/jdk11u-dev/pull/3087#issuecomment-3266882552


More information about the jdk-updates-dev mailing list