Skip to content
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

Support sorting items by name #2949

Open
bjorn3 opened this issue Oct 15, 2024 · 3 comments
Open

Support sorting items by name #2949

bjorn3 opened this issue Oct 15, 2024 · 3 comments

Comments

@bjorn3
Copy link
Member

bjorn3 commented Oct 15, 2024

Currently there is only --sort-semantically to sort by item type. Sorting by name would make it easier to diff bindings generated for different platforms that have different order of items in their headers.

@pvdrz
Copy link
Contributor

pvdrz commented Oct 15, 2024

Maybe --sort-semantically should be superseded by a ParseCallback that gives you the necessary info to sort it however you want.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 17, 2024

I'm using the bindgen cli, so a callback won't work. I don't really care about the exact order in which items are sorted for as long as the output doesn't depend on the order of items in the C source and is robust against additions and removals of items in the C source.

@pvdrz
Copy link
Contributor

pvdrz commented Oct 17, 2024

This issue makes me think that we need some standard way to turn ParseCallbacks into some kind of interface that works nicely with bindgen-cli.

The easiest thing that comes to mind is probably being able to specify a command that can communicate with bindgen via stdio, but that means that we need to agree on the input and output format and maintain it under our stability guarantees.

Another option would be to allow bindgen to dynamically load a library that does this for us. The advantage there is that we can "just" use the C ABI for everything but at the same time it means that you cannot just write a bash script for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants