Skip to content

proof-of-concept: preserve fixed width integer types#299

Draft
Marcono1234 wants to merge 4 commits intoopenjdk:masterfrom
Marcono1234:portable-library
Draft

proof-of-concept: preserve fixed width integer types#299
Marcono1234 wants to merge 4 commits intoopenjdk:masterfrom
Marcono1234:portable-library

Conversation

@Marcono1234
Copy link

@Marcono1234 Marcono1234 commented Jan 25, 2026

For https://mail.openjdk.org/pipermail/jextract-dev/2026-January/002449.html (and previous thread messages)

This proof-of-concept is incomplete, but it demonstrates that (most likely) enough information is available to jextract to preserve the original types, and keep the C library portable.

For example the portable type int64_t could be preserved instead of turning it into the non-portable long.
When trying this locally with jtreesitter's jextract setup on Windows it seemed to emit portable code, without using types such as long or long long anymore. The only exception are C enums, which use int, but that appears to be portable (and since C23 it is also possible to specify a fixed type for an enum).

Most likely I will not complete this pull request; its main purpose is to highlight which code changes might be needed to preserve typedef information (but I am not very familiar with this project, so maybe there are missing places, and better ways to solve this).
Hopefully this is useful nonetheless.

Feel free to close this pull request.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed (no review required)

Error

 ⚠️ OCA signatory status must be verified

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jextract.git pull/299/head:pull/299
$ git checkout pull/299

Update a local copy of the PR:
$ git checkout pull/299
$ git pull https://git.openjdk.org/jextract.git pull/299/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 299

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jextract/pull/299.diff

This POC is incomplete, but it demonstrates that (most likely) enough
information is available to jextract to preserve the original types, and
keep the library portable.
@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Jan 25, 2026
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 25, 2026

Hi @Marcono1234, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user Marcono1234" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Jan 25, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

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

Labels

oca Needs verification of OCA signatory status

Development

Successfully merging this pull request may close these issues.

1 participant