gtk-rs / gir

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

Should generate deprecate warning in rust code, when C code macro expand to `__attribute__` `__deprecated__` #1522

Open loynoir opened 1 year ago

loynoir commented 1 year ago

reproduce

C code

GDK_DEPRECATED_IN_4_10_FOR(gtk_widget_set_visible or gtk_window_present)
void       gtk_widget_show 
__attribute__((__deprecated__("Use '" "gtk_widget_set_visible or gtk_window_present" "' instead"))) extern
void       gtk_widget_show 

actual

rust code

// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
    pub fn gtk_widget_should_layout(widget: *mut GtkWidget) -> gboolean;
    pub fn gtk_widget_show(widget: *mut GtkWidget);
    pub fn gtk_widget_size_allocate(

expected

Deprecate warning when use rust gtk4_sys::gtk_widget_show

bilelmoussaoui commented 1 year ago

the deprecated attribute is only generated for the safe api wrapper

loynoir commented 1 year ago

@bilelmoussaoui

I use rust as modern C.

Would be nice to receive deprecation within gtk4_sys::gtk_widget_show

sdroege commented 1 year ago

Seems like a good idea to have that in gir, but less important than for the safe API. Do you want to provide a PR for this? The information about deprecations is already available in the code generator, just not made use for when generating the -sys bindings.

loynoir commented 1 year ago

I think, instead of

should

In my option,

sdroege commented 1 year ago

Yes that's what I'm saying. Do you want to provide a PR for that?

loynoir commented 1 year ago

Sorry, willing to, but sticking with something else.