gtk-rs / gir

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

Incorrect warnings when generating in `sys` mode #1400

Closed Megadash452 closed 1 year ago

Megadash452 commented 1 year ago

When trying to ignore some symbols, the gir program will falsely flag those symbols as "missing from the library".

For example, in my case i have this ignore in my Gir.toml:

ignore = [
    "GIRepository.MICRO_VERSION",
    "GIRepository.MINOR_VERSION",
]

and running gir with this gives the following output:

[WARN  libgir::config::gobjects] Configured object `GIRepository.MICRO_VERSION` missing from the library
[WARN  libgir::config::gobjects] Configured object `GIRepository.MINOR_VERSION` missing from the library

but when I build and test, those constants are not present in test/abi.rs, so the ignore was successful.

@bilelmoussaoui suggested i open this issue to get this fixed.

Megadash452 commented 1 year ago

I think the problem has to do with these being constants, but somewhere they are being seen as GObject types. In src/config/gobjects.rs::resolve_type_ids, the objects arg contains these constants, which then this function tries to find a Gobject type with this name (i think this is what this part does: library.find_type(0, name);), but it returns none because there is no type with those names since those are constants.