proof-of-concept: preserve fixed width integer types#299
proof-of-concept: preserve fixed width integer types#299Marcono1234 wants to merge 4 commits intoopenjdk:masterfrom
Conversation
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.
|
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 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 |
|
❗ This change is not yet ready to be integrated. |
(since they only exist for C++)
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_tcould be preserved instead of turning it into the non-portablelong.When trying this locally with jtreesitter's jextract setup on Windows it seemed to emit portable code, without using types such as
longorlong longanymore. The only exception are C enums, which useint, 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
Error
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jextract.git pull/299/head:pull/299$ git checkout pull/299Update a local copy of the PR:
$ git checkout pull/299$ git pull https://git.openjdk.org/jextract.git pull/299/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 299View PR using the GUI difftool:
$ git pr show -t 299Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jextract/pull/299.diff