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

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

Open
loynoir opened this issue Oct 25, 2023 · 6 comments

Comments

@loynoir
Copy link

loynoir commented Oct 25, 2023

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

@loynoir loynoir changed the title Should generate deprecate warning in rust code, if C code macro expand to __attribute__ __deprecated__ Should generate deprecate warning in rust code, when C code macro expand to __attribute__ __deprecated__ Oct 25, 2023
@bilelmoussaoui
Copy link
Member

the deprecated attribute is only generated for the safe api wrapper

@loynoir
Copy link
Author

loynoir commented Oct 31, 2023

@bilelmoussaoui

I use rust as modern C.

Would be nice to receive deprecation within gtk4_sys::gtk_widget_show

@sdroege
Copy link
Member

sdroege commented Oct 31, 2023

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
Copy link
Author

loynoir commented Nov 1, 2023

I think, instead of

  • change every downstream build script

should

  • let upstream gir options default to generate deprecation

In my option,

  • With deprecation mapping, will be 1:1 mapping.

@sdroege
Copy link
Member

sdroege commented Nov 1, 2023

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

@loynoir
Copy link
Author

loynoir commented Nov 1, 2023

Sorry, willing to, but sticking with something else.

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

3 participants