forked from reitermarkus/rust-bindgen
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Given that C keeps a different namespace for `struct`/`enum`/`union` and `typedef` aliases. The following patterns ```c typedef const struct foo { void *inner; } *foo; typedef struct bar { void *inner; } *bar; ``` are valid C code and produces both a `struct` and a pointer called `foo` and `bar` in different namespaces. Given that Rust does not make this distinction, we add the `_ptr` prefix to the pointer type aliases to avoid any name collisions.
- Loading branch information
1 parent
4cb6fb7
commit e02a249
Showing
3 changed files
with
201 additions
and
3 deletions.
There are no files selected for viewing
153 changes: 153 additions & 0 deletions
153
bindgen-tests/tests/expectations/tests/typedef-pointer-overlap.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
typedef const struct foo { | ||
char inner; | ||
} *foo; | ||
|
||
typedef struct bar { | ||
char inner; | ||
} *bar; | ||
|
||
typedef struct baz *baz; | ||
|
||
typedef union cat { | ||
int standard_issue; | ||
} *cat; | ||
|
||
typedef enum mad { scientist } *mad; | ||
|
||
void takes_foo_ptr(foo); | ||
void takes_foo_struct(struct foo); | ||
|
||
void takes_bar_ptr(bar); | ||
void takes_bar_struct(struct bar); | ||
|
||
void takes_baz_ptr(baz); | ||
void takes_baz_struct(struct baz); | ||
|
||
void takes_cat_ptr(cat); | ||
void takes_cat_union(union cat); | ||
|
||
void takes_mad_ptr(mad); | ||
void takes_mad_enum(enum mad); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters