Messages in this thread |  | | From | Miguel Ojeda <> | | Date | Tue, 25 Mar 2025 20:48:17 +0100 | | Subject | Re: [PATCH] rust: workaround `bindgen` issue with forward references to `enum` types |
| |
On Tue, Mar 25, 2025 at 7:43 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > Instead, let's have a section at the top of our `bindings_helper.h` that > `#include`s the headers with the affected types -- hopefully there are > not many cases and there is a single ordering that covers all cases.
By the way, I was curious and from a quick look at generated bindings lines matching `type.*i32` for a x86_64 build I have, I see only other three cases:
- `key_serial_t` is not an `enum`, i.e. it is correct.
- `fs_value_type` and `drm_mode_status` are both `enum`s, and they indeed suffer from this issue. However, we do not use them and I don't see any patches posted for them either.
Those are good news.
However, there are also bad news: if for instance we actually needed either of those two latter ones, then we cannot just include the header that defines them, because that header happens to include others that in turn use forward references to that `enum` the root one defines.
So in some cases, if we start to use them before we have a fix, would require C header changes to avoid the forward references. Thus, for those, I think it may be simpler to instead use a cast and mark them with a comment so that we know we should clean them up.
Cheers, Miguel
|  |