gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
225 stars 98 forks source link

Add C compilation tests for functions in -sys crates #657

Open sdroege opened 5 years ago

sdroege commented 5 years ago

This requires adding some code for the different parameters types but generally shouldn't be too hard. It doesn't have to be valid data, just correctly typed. E.g. ((GObject *) 0) would be good for everything that takes a GObject *, similarly for arrays, etc.

By this we would catch those annoying problems we had in the past where an array-of-pointers was generated as a flat array of some fundamental type instead, for example.

ghost commented 5 years ago

I would recommend ctest crate. It can automatically generate tests that compare function signatures between C and Rust.

I even set it up for sys crates at some point, but there was enough bugs in gobject-introspection scanner that it didn't make sense in including it here. Now situations should be a little bit improved, especially with respect to array handling.

GuillaumeGomez commented 5 years ago

Any updates in here?