-
Notifications
You must be signed in to change notification settings - Fork 694
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
Attribute btf_type_tag
makes const
ness of pointers disappear
#2244
Comments
It seems clang treats these a bit differently internally. For that function we get:
If I remove the attribute:
In particular, it seems |
Seems constness is completely lost at the libclang level :'( From a quick printf like this: diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index d573408c..13701e28 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -1032,6 +1032,7 @@ impl Type {
CXType_MemberPointer |
CXType_Pointer => {
let pointee = ty.pointee_type().unwrap();
+ println!("{:?} -> {:?} is_const {:?} -> {:?}", ty, pointee, ty.is_const(), pointee.is_const());
let inner =
Item::from_ty_or_ref(pointee, location, None, ctx);
TypeKind::Pointer(inner)
However from a clang ast dump with
|
Using the canonical type fixes this but changes the output of some tests (in particular, pointer to typedefs now point to the underlying type). That seems somewhat acceptable tho, and shouldn't be a correctness regression (so this patch should be a correctness improvement). Fixes #2244
Using the canonical type fixes this but changes the output of some tests (in particular, pointer to typedefs now point to the underlying type). So do this only in known-bad cases. Fixes #2244
Using the canonical type fixes this but changes the output of some tests (in particular, pointer to typedefs now point to the underlying type). So do this only in known-bad cases. Fixes #2244
Using the canonical type fixes this but changes the output of some tests (in particular, pointer to typedefs now point to the underlying type). So do this only in known-bad cases. Fixes #2244
@ojeda I think you can drop the workaround now from kbuild if you upgrade to a newer release of bindgen that has this fix? |
Using the canonical type fixes this but changes the output of some tests (in particular, pointer to typedefs now point to the underlying type). So do this only in known-bad cases. Fixes rust-lang#2244
From Rust-for-Linux/linux#835, reported by @YakoYakoYokuYoku.
I have not checked yet whether this is due to libclang, but nevertheless I wanted to have the issue opened here.
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
The text was updated successfully, but these errors were encountered: