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

Zdenek Zambersky zzambers at openjdk.org
Wed Sep 3 11:28:24 UTC 2025


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)

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

Commit messages:
 - backport 03428d73fc3618202627bbe9d9880a63221c1811

Changes: https://git.openjdk.org/jdk11u-dev/pull/3087/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=3087&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8224087
  Stats: 35 lines in 4 files changed: 33 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk11u-dev/pull/3087.diff
  Fetch: git fetch https://git.openjdk.org/jdk11u-dev.git pull/3087/head:pull/3087

PR: https://git.openjdk.org/jdk11u-dev/pull/3087


More information about the jdk-updates-dev mailing list