-
Notifications
You must be signed in to change notification settings - Fork 708
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
Cannot override integer type of constified enum module. #2711
Comments
That's kind of intentional, because functions taking a |
Same for structs containing it or what not. Thus, not clear it's a bug, would be rather dangerous to do as proposed. But please reopen if you disagree or I've gotten something wrong. |
@emilio Sorry, my example had too little context. I get your point but in this case, the real public type is node_kind (u16), not node_kinds (c_int), i.e.: typedef uint16_t node_kind;
// node_kinds exposes the valid values as a convenience,
// but the type itself is never used in the API
enum node_kinds {
NODE_KIND_FOO = 1,
// ... lotta kinds
};
typedef struct _node {
node_kind kind; // uint16_t
// ...
} node;
node* node_new_empty(node_kind kind); // takes an uint16_t There are many other places like this in the library, where:
It gets even more annoying when
Let's say it's a feature request then. 😉
Of course, if implemented it should definitely be opt-in.
Please note that regular users cannot reopen issues on this tracker. |
reopening as per the above though I still think it'd be rather footgunny. |
Hi,
Sorry if I'm missing something but there doesn't seem to be a way to override the integer type of a constified enum module.
I tried the naive approach of using
ParseCallbacks::int_macro
, but to no avail.Input C Header
Bindgen Invocation
Actual Results
Expected Results
There should be a way to obtain the following result:
As a side note, this is another use case for #1916.
The text was updated successfully, but these errors were encountered: