Skip to content

Commit

Permalink
fix: resolve path types for 'both' style
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Nov 1, 2020
1 parent a689bca commit 6bccf66
Show file tree
Hide file tree
Showing 150 changed files with 498 additions and 478 deletions.
2 changes: 1 addition & 1 deletion src/bindgen/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl Library {
}

fn resolve_declaration_types(&mut self) {
if self.config.style.generate_typedef() {
if !self.config.style.generate_tag() {
return;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/expectations/alias.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ typedef struct Dep {
typedef struct Foo_i32 {
int32_t a;
int32_t b;
Dep c;
struct Dep c;
} Foo_i32;

typedef Foo_i32 IntFoo;
typedef struct Foo_i32 IntFoo;

typedef struct Foo_f64 {
double a;
double b;
Dep c;
struct Dep c;
} Foo_f64;

typedef Foo_f64 DoubleFoo;
typedef struct Foo_f64 DoubleFoo;

typedef int32_t Unit;

Expand Down
8 changes: 4 additions & 4 deletions tests/expectations/alias.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ typedef struct Dep {
typedef struct Foo_i32 {
int32_t a;
int32_t b;
Dep c;
struct Dep c;
} Foo_i32;

typedef Foo_i32 IntFoo;
typedef struct Foo_i32 IntFoo;

typedef struct Foo_f64 {
double a;
double b;
Dep c;
struct Dep c;
} Foo_f64;

typedef Foo_f64 DoubleFoo;
typedef struct Foo_f64 DoubleFoo;

typedef int32_t Unit;

Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/annotation.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ typedef struct H {
};
} H;

void root(A x, B y, C z, F f, H h);
void root(struct A x, struct B y, C z, union F f, struct H h);
2 changes: 1 addition & 1 deletion tests/expectations/annotation.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ typedef struct H {
extern "C" {
#endif // __cplusplus

void root(A x, B y, C z, F f, H h);
void root(struct A x, struct B y, C z, union F f, struct H h);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/array.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ typedef struct Foo {
};
} Foo;

void root(Foo a);
void root(struct Foo a);
2 changes: 1 addition & 1 deletion tests/expectations/array.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef struct Foo {
extern "C" {
#endif // __cplusplus

void root(Foo a);
void root(struct Foo a);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/asserted_cast.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ typedef union K {
K_Bar_Body bar;
} K;

void foo(H h, I i, J j, K k);
void foo(struct H h, struct I i, struct J j, union K k);
2 changes: 1 addition & 1 deletion tests/expectations/asserted_cast.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ typedef union K {
extern "C" {
#endif // __cplusplus

void foo(H h, I i, J j, K k);
void foo(struct H h, struct I i, struct J j, union K k);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/assoc_constant.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ typedef struct Foo {
#define Foo_GA 10
#define Foo_ZO 3.14

void root(Foo x);
void root(struct Foo x);
2 changes: 1 addition & 1 deletion tests/expectations/assoc_constant.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct Foo {
extern "C" {
#endif // __cplusplus

void root(Foo x);
void root(struct Foo x);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/associated_in_body.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ typedef struct StyleAlignFlags {
*/
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = (uint8_t)(1 << 3) }

void root(StyleAlignFlags flags);
void root(struct StyleAlignFlags flags);
2 changes: 1 addition & 1 deletion tests/expectations/associated_in_body.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct StyleAlignFlags {
extern "C" {
#endif // __cplusplus

void root(StyleAlignFlags flags);
void root(struct StyleAlignFlags flags);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/bitfield.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ typedef struct HasBitfields {
uint64_t bar: 56;
} HasBitfields;

void root(const HasBitfields*);
void root(const struct HasBitfields*);
2 changes: 1 addition & 1 deletion tests/expectations/bitfield.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef struct HasBitfields {
extern "C" {
#endif // __cplusplus

void root(const HasBitfields*);
void root(const struct HasBitfields*);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/bitflags.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ typedef struct DebugFlags {
*/
#define DebugFlags_BIGGEST_ALLOWED (DebugFlags){ .bits = (uint32_t)(1 << 31) }

void root(AlignFlags flags, DebugFlags bigger_flags);
void root(struct AlignFlags flags, struct DebugFlags bigger_flags);
2 changes: 1 addition & 1 deletion tests/expectations/bitflags.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ typedef struct DebugFlags {
extern "C" {
#endif // __cplusplus

void root(AlignFlags flags, DebugFlags bigger_flags);
void root(struct AlignFlags flags, struct DebugFlags bigger_flags);

#ifdef __cplusplus
} // extern "C"
Expand Down
16 changes: 8 additions & 8 deletions tests/expectations/body.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ typedef union MyUnion_Prepended {
uint32_t u;
} MyUnion_Prepended;

void root(MyFancyStruct s,
MyFancyEnum e,
MyCLikeEnum c,
MyUnion u,
MyFancyStruct_Prepended sp,
MyFancyEnum_Prepended ep,
MyCLikeEnum_Prepended cp,
MyUnion_Prepended up);
void root(struct MyFancyStruct s,
struct MyFancyEnum e,
enum MyCLikeEnum c,
union MyUnion u,
struct MyFancyStruct_Prepended sp,
struct MyFancyEnum_Prepended ep,
enum MyCLikeEnum_Prepended cp,
union MyUnion_Prepended up);
16 changes: 8 additions & 8 deletions tests/expectations/body.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ typedef union MyUnion_Prepended {
extern "C" {
#endif // __cplusplus

void root(MyFancyStruct s,
MyFancyEnum e,
MyCLikeEnum c,
MyUnion u,
MyFancyStruct_Prepended sp,
MyFancyEnum_Prepended ep,
MyCLikeEnum_Prepended cp,
MyUnion_Prepended up);
void root(struct MyFancyStruct s,
struct MyFancyEnum e,
enum MyCLikeEnum c,
union MyUnion u,
struct MyFancyStruct_Prepended sp,
struct MyFancyEnum_Prepended ep,
enum MyCLikeEnum_Prepended cp,
union MyUnion_Prepended up);

#ifdef __cplusplus
} // extern "C"
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/box.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ using Box = T*;

typedef struct NotReprC_Box_i32 NotReprC_Box_i32;

typedef NotReprC_Box_i32 Foo;
typedef struct NotReprC_Box_i32 Foo;

typedef struct MyStruct {
int32_t *number;
} MyStruct;

void root(const Foo *a, const MyStruct *with_box);
void root(const Foo *a, const struct MyStruct *with_box);

void drop_box(int32_t *x);

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/box.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using Box = T*;

typedef struct NotReprC_Box_i32 NotReprC_Box_i32;

typedef NotReprC_Box_i32 Foo;
typedef struct NotReprC_Box_i32 Foo;

typedef struct MyStruct {
int32_t *number;
Expand All @@ -21,7 +21,7 @@ typedef struct MyStruct {
extern "C" {
#endif // __cplusplus

void root(const Foo *a, const MyStruct *with_box);
void root(const Foo *a, const struct MyStruct *with_box);

void drop_box(int32_t *x);

Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/cell.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;

typedef NotReprC_RefCell_i32 Foo;
typedef struct NotReprC_RefCell_i32 Foo;

typedef struct MyStruct {
int32_t number;
} MyStruct;

void root(const Foo *a, const MyStruct *with_cell);
void root(const Foo *a, const struct MyStruct *with_cell);
4 changes: 2 additions & 2 deletions tests/expectations/cell.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

typedef struct NotReprC_RefCell_i32 NotReprC_RefCell_i32;

typedef NotReprC_RefCell_i32 Foo;
typedef struct NotReprC_RefCell_i32 Foo;

typedef struct MyStruct {
int32_t number;
Expand All @@ -15,7 +15,7 @@ typedef struct MyStruct {
extern "C" {
#endif // __cplusplus

void root(const Foo *a, const MyStruct *with_cell);
void root(const Foo *a, const struct MyStruct *with_cell);

#ifdef __cplusplus
} // extern "C"
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/cfg.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ typedef struct BarHandle {
#endif

#if (defined(PLATFORM_UNIX) && defined(X11))
void root(FooHandle a, C c);
void root(struct FooHandle a, union C c);
#endif

#if (defined(PLATFORM_WIN) || defined(M_32))
void root(BarHandle a, C c);
void root(struct BarHandle a, union C c);
#endif
4 changes: 2 additions & 2 deletions tests/expectations/cfg.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ extern "C" {
#endif // __cplusplus

#if (defined(PLATFORM_UNIX) && defined(X11))
void root(FooHandle a, C c);
void root(struct FooHandle a, union C c);
#endif

#if (defined(PLATFORM_WIN) || defined(M_32))
void root(BarHandle a, C c);
void root(struct BarHandle a, union C c);
#endif

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions tests/expectations/cfg_2.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ typedef struct Foo {

#if defined(NOT_DEFINED)
typedef struct Bar {
Foo y;
struct Foo y;
} Bar;
#endif

#if defined(DEFINED)
typedef struct Bar {
Foo z;
struct Foo z;
} Bar;
#endif

typedef struct Root {
Bar w;
struct Bar w;
} Root;

void root(Root a);
void root(struct Root a);
8 changes: 4 additions & 4 deletions tests/expectations/cfg_2.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ typedef struct Foo {

#if defined(NOT_DEFINED)
typedef struct Bar {
Foo y;
struct Foo y;
} Bar;
#endif

#if defined(DEFINED)
typedef struct Bar {
Foo z;
struct Foo z;
} Bar;
#endif

typedef struct Root {
Bar w;
struct Bar w;
} Root;

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

void root(Root a);
void root(struct Root a);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/char.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ typedef struct Foo {
uint32_t a;
} Foo;

void root(Foo a);
void root(struct Foo a);
2 changes: 1 addition & 1 deletion tests/expectations/char.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ typedef struct Foo {
extern "C" {
#endif // __cplusplus

void root(Foo a);
void root(struct Foo a);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/constant.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ typedef struct Foo {
int32_t x[FOO];
} Foo;

void root(Foo x);
void root(struct Foo x);
2 changes: 1 addition & 1 deletion tests/expectations/constant.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef struct Foo {
extern "C" {
#endif // __cplusplus

void root(Foo x);
void root(struct Foo x);

#ifdef __cplusplus
} // extern "C"
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/dep_v2.both.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ typedef struct dep_struct {
double y;
} dep_struct;

uint32_t get_x(const dep_struct *dep_struct);
uint32_t get_x(const struct dep_struct *dep_struct);
2 changes: 1 addition & 1 deletion tests/expectations/dep_v2.both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef struct dep_struct {
extern "C" {
#endif // __cplusplus

uint32_t get_x(const dep_struct *dep_struct);
uint32_t get_x(const struct dep_struct *dep_struct);

#ifdef __cplusplus
} // extern "C"
Expand Down
Loading

0 comments on commit 6bccf66

Please sign in to comment.