Skip to content

WIP: deprecation support#255

Draft
J. David Lowe (dlowe) wants to merge 1 commit into
deburrfrom
deprecation-support
Draft

WIP: deprecation support#255
J. David Lowe (dlowe) wants to merge 1 commit into
deburrfrom
deprecation-support

Conversation

@dlowe

@dlowe J. David Lowe (dlowe) commented Apr 30, 2025

Copy link
Copy Markdown

WIP for early feedback.

known TODOs assuming I'm on the right track:

  • MAYBE: better testing?
  • MAYBE: consider propagating the rust #[deprecated] annotation to the generated (rust) shim function? This probably doesn't really accomplish anything, since it covers calling the shim function from rust code, which is already very weird, I think?
  • parse the #[deprecated] attribute on non-fn elements
  • support for the #[deprecated(note = "foo")] attribute syntax
  • emit csharp doxygen deprecated tagged docstring
  • emit csharp ObsoleteAttribute annotations
  • documentation

Comment thread src/headers/_mod.rs
lang: Language,
docs: &'_ [&'_ str],
// an Option<&str> passed as an empty or exactly-one-element slice... is there a better way?
deprecated: &'_ [&'static str],

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Daniel Henry-Mantilla (@danielhenrymantilla) I don't love this, any better ideas?

abort_on_unwind_guard = #ඞ::UnwindGuard(#export_name_str),
unsafe {
#layout::into_raw(
#[allow(deprecated)]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could make this allow conditional on the function actually being deprecated, I suppose? It doesn't seem worth the effort, but I could be persuaded.

mk_out!(indent, ctx.out());

if docs.is_empty() {
if docs.is_empty() && deprecated.is_none() {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't exactly right, but I think getting it exactly right requires a bit of a deeper refactor.

@dlowe J. David Lowe (dlowe) changed the base branch from master to deburr May 7, 2025 16:30
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

Successfully merging this pull request may close these issues.

1 participant