-
Notifications
You must be signed in to change notification settings - Fork 742
Support #define old_function new_function #2544
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
Labels
Comments
davidben
added a commit
to google/boringssl
that referenced
this issue
Jun 26, 2023
The standard macro-based pattern does not work in bindgen because of rust-lang/rust-bindgen#2544 Change-Id: Ic2b92e779ade2ed55a627bba9c76f7df5c0f6136 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61185 Reviewed-by: Bob Beck <[email protected]> Commit-Queue: Bob Beck <[email protected]> Auto-Submit: David Benjamin <[email protected]>
The cuda headers also do this, for example in cuda v12.2 header #define cudaGetDeviceProperties cudaGetDeviceProperties_v2 |
samuel40791765
pushed a commit
to samuel40791765/aws-lc
that referenced
this issue
Nov 10, 2023
The standard macro-based pattern does not work in bindgen because of rust-lang/rust-bindgen#2544 Change-Id: Ic2b92e779ade2ed55a627bba9c76f7df5c0f6136 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61185 Reviewed-by: Bob Beck <[email protected]> Commit-Queue: Bob Beck <[email protected]> Auto-Submit: David Benjamin <[email protected]> (cherry picked from commit 4e88a3557f6a022e30d1ff85fbd87e1173848be2)
samuel40791765
pushed a commit
to samuel40791765/aws-lc
that referenced
this issue
Nov 14, 2023
The standard macro-based pattern does not work in bindgen because of rust-lang/rust-bindgen#2544 Change-Id: Ic2b92e779ade2ed55a627bba9c76f7df5c0f6136 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61185 Reviewed-by: Bob Beck <[email protected]> Commit-Queue: Bob Beck <[email protected]> Auto-Submit: David Benjamin <[email protected]> (cherry picked from commit 4e88a3557f6a022e30d1ff85fbd87e1173848be2)
samuel40791765
pushed a commit
to samuel40791765/aws-lc
that referenced
this issue
Nov 14, 2023
The standard macro-based pattern does not work in bindgen because of rust-lang/rust-bindgen#2544 Change-Id: Ic2b92e779ade2ed55a627bba9c76f7df5c0f6136 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61185 Reviewed-by: Bob Beck <[email protected]> Commit-Queue: Bob Beck <[email protected]> Auto-Submit: David Benjamin <[email protected]> (cherry picked from commit 4e88a3557f6a022e30d1ff85fbd87e1173848be2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
Ideally
old_function_name
would also be available as an alias fornew_function_name
. This pattern is quite common in C libraries.In OpenSSL, they like to define compatibility aliases like this:
https://github.com/openssl/openssl/blob/master/include/openssl/x509.h.in#L732-L742
In glibc, these may not even be compatibility aliases but the actual intended public API. E.g. my system headers say:
It's also used to fake something like C++
inline namespace
, when you want the symbol to have a prefixed name to avoid collisions, but to support callers writing another.On the C library authoring side, we would like to do this for deprecated functions in BoringSSL, as it's much less tedious than defining a parallel function or an inline wrapper. But, were we do to this, it would break
bindgen
output due tobindgen
insufficiently faithfully supporting C semantics. Of course, fully faithfully supporting C macros is Hard, but this case seems straightforward and common enough to be worth picking up. (When the destination is a single symbol that is a function you already know to bind.)One caveat when doing this, the feature should not break things like this:
We have to do that sometimes in BoringSSL for... very dumb reasons. :-)
The text was updated successfully, but these errors were encountered: