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

Use c2rust for cleaning up produced bindings #1652

Closed
XVilka opened this issue Oct 21, 2019 · 4 comments
Closed

Use c2rust for cleaning up produced bindings #1652

XVilka opened this issue Oct 21, 2019 · 4 comments

Comments

@XVilka
Copy link

XVilka commented Oct 21, 2019

There is an issue to use c2rust for tranlating inline functions, but if you check the output of bindgen, you can spot some patterns that c2rust also normally works with, so they created an amazing refactoring tool. And it can be scripted with Lua, so some bindgen-specific automation can be easily added without much changes from c2rust side - see their manual for refactoring tool. Sorry if idea is irrelevant, just thought it might be handy.

cc @thedataking @rinon @ahomescu @TheDan64

@emilio
Copy link
Contributor

emilio commented Oct 22, 2019

I think it's interesting, but what kind of refactoring do you want to apply to the generated bindings?

In general bindgen doesn't produce a lot of stuff other than declarations, typedefs, etc, so it's not clear to me what you can or cannot cleanup from them...

Do you have concrete examples or ideas?

@rinon
Copy link
Contributor

rinon commented Nov 4, 2019

I'm not sure refactoring is really needed for the auto-generated bindings. If there's particularly ugly codegen the generator could be fixed, but I'm not sure that's needed. When I've used bindgen I generally never look at the generated code, instead using the C header as API docs.

That said, I'd be happy to look into any particular refactoring that could be useful, if there are any.

@XVilka
Copy link
Author

XVilka commented Nov 6, 2019

It was just a wild idea, you can close if you think it is useless. Sorry for disturbance.

@emilio
Copy link
Contributor

emilio commented Nov 6, 2019

No, no worries at all, it's appreciated :)

Closing as this is not actionable as-is, but feel free to reopen if there's anything concrete that could be done here.

@emilio emilio closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants