-
Notifications
You must be signed in to change notification settings - Fork 247
8224087: Compile C code for at least C99 Standard compliance #3087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back zzambers! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
This backport pull request has now been updated with issue from the original commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in two minds about this. Specifying the standard explicitly is the right thing to do (I added similar for C++ years back) but we could just make that C90 so as to not raise older compilers.
I think, given some compilers have been defaulting to C99 for some time anyway (and maybe even later), this should be safe and may avoid problems with future backports. Let's get it in early and ensure it is well tested before January.
What compilers have you tested this change with?
I was also thinking, whether c99 is ok here, but given that jdk13 has same minimum compiler versions, it should be safe. Apart from testing in GHA. I tested these compiler versions (WORK):
Minimum accepted versions are gcc-4.8 and clang 3.2, so I tried to get close to that, based on what is available in old rhel/debian, not building my own toolchain. (Debian Jessie has clang 3.5, but that one (clang) was segfaulting during the build even on master, and Wheezy has clang 3.0) For msvc there should be no change in compiler flags by this backport. When it comes to Solaris, I could not test build there, because I don't have that OS available to me. But given that some awt libraries were already compiled with c99 flags, compiler flags should work. |
Build logs: |
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, causing errors (jdk sources are not c23 compatible).
Main problem is, that c23 no longer supports non-prototype function declarations (see (3) here). Example errors:
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, where this originates from, has same minimal compiler requirements as jdk11. ( gcc 4.8, clang 3.2, Xcode 8, Solaris Studio 12.4)
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3087/head:pull/3087
$ git checkout pull/3087
Update a local copy of the PR:
$ git checkout pull/3087
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3087/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3087
View PR using the GUI difftool:
$ git pr show -t 3087
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3087.diff
Using Webrev
Link to Webrev Comment