Skip to content

8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type#4522

Open
fthevenet wants to merge 1 commit into
openjdk:masterfrom
fthevenet:backport-548d07d
Open

8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type#4522
fthevenet wants to merge 1 commit into
openjdk:masterfrom
fthevenet:backport-548d07d

Conversation

@fthevenet

@fthevenet fthevenet commented Jun 17, 2026

Copy link
Copy Markdown
Member

This is an unclean backport of of commit 548d07d3 from the openjdk/jdk repository (itslef a backport of 76a44b3e from openjdk/jdk).

The aim for this backport is to address compiler warnings that arise when attempting to build with with more recent version of gcc (16.1+).

The backport does not apply cleanly, because I had to omit the clean-up of an used variable in log_messages.c that was introduced in jdk 20 as part of JDK-8289768.
I opted to not do a prior backport for JDK-8289768, as it touches quite a large number of files.

I have verified that with this patch, jdk17u-dev compiles without warning on Fedora 44 with gcc 16.1.1.



Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8378180 needs maintainer approval

Issue

  • JDK-8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type (Enhancement - P3 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/4522/head:pull/4522
$ git checkout pull/4522

Update a local copy of the PR:
$ git checkout pull/4522
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/4522/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4522

View PR using the GUI difftool:
$ git pr show -t 4522

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/4522.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 17, 2026

Copy link
Copy Markdown

👋 Welcome back fthevenet! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 17, 2026

Copy link
Copy Markdown

@fthevenet This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type

Reviewed-by: andrew

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 15 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@gnu-andrew) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk Bot changed the title backport 548d07d313ba16e6d99cfdfcc37165be89c242dc 8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type Jun 17, 2026
@openjdk

openjdk Bot commented Jun 17, 2026

Copy link
Copy Markdown

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Jun 17, 2026
@fthevenet fthevenet marked this pull request as ready for review June 17, 2026 11:29
@openjdk

openjdk Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ @fthevenet This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 17, 2026
@mlbridge

mlbridge Bot commented Jun 17, 2026

Copy link
Copy Markdown

Webrevs

@fthevenet

Copy link
Copy Markdown
Member Author

/approval request I'd like to backport this to JDK 17.

Motivation: This patch is needed in order to build jdk17u with more recent version of gcc (16.1.1+), as it fixes compiler warnings.
The backport does not apply cleanly, because I had to omit the clean-up of an used variable in log_messages.c that was introduced in jdk 20 as part of JDK-8289768.
I opted to not do a prior backport for JDK-8289768, as it touches quite a large number of files.

The change introduces no behaviour change and is low risk.

I have verified that with this patch, jdk17u-dev compiles without warning on Fedora 44 with gcc 16.1.1.

@openjdk

openjdk Bot commented Jun 18, 2026

Copy link
Copy Markdown

@fthevenet
8378180: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Jun 18, 2026
@gnu-andrew

Copy link
Copy Markdown
Member

/reviewer 1 reviewer

Not sure why this is being marked clean when it is not clean by the submitter's own admission.

@openjdk

openjdk Bot commented Jun 24, 2026

Copy link
Copy Markdown

@gnu-andrew Only the author (@fthevenet) is allowed to issue the reviewer command.

@gnu-andrew

Copy link
Copy Markdown
Member

/reviewers 1 reviewer

@openjdk

openjdk Bot commented Jun 24, 2026

Copy link
Copy Markdown

@gnu-andrew
Warning: By issuing the /reviewers command in this clean backport pull request, the reviewers check has now been enabled.
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 1 (with at least 1 Reviewer).

@gnu-andrew gnu-andrew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch looks good to me. There's no need to backport a change that just touched the same copyright header and especially not a cleanup one.

Despite the subject, I don't believe this is related to C23, as 17u should be passing -std=c99. It's likely just additional warnings with a newer gcc.

@openjdk openjdk Bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Jun 25, 2026
@fthevenet

Copy link
Copy Markdown
Member Author

Thanks for the review, @gnu-andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants