Skip to content

Commit

Permalink
Add a test for mangling of array generics.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Oct 27, 2024
1 parent 4501cc9 commit dce986b
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ typedef struct {

typedef Foo_____u8 Boo;

typedef struct {
uint8_t a[4];
} Foo__________u8__________4;

void root(Boo x);

void my_function(Foo__________u8__________4 x);
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ typedef struct {

typedef Foo_____u8 Boo;

typedef struct {
uint8_t a[4];
} Foo__________u8__________4;

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

void root(Boo x);

void my_function(Foo__________u8__________4 x);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
2 changes: 2 additions & 0 deletions tests/expectations/generic_pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ extern "C" {

void root(Boo x);

void my_function(Foo<uint8_t[4]> x);

} // extern "C"
5 changes: 5 additions & 0 deletions tests/expectations/generic_pointer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ cdef extern from *:

ctypedef Foo_____u8 Boo;

ctypedef struct Foo__________u8__________4:
uint8_t a[4];

void root(Boo x);

void my_function(Foo__________u8__________4 x);
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer_both.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ typedef struct Foo_____u8 {

typedef struct Foo_____u8 Boo;

typedef struct Foo__________u8__________4 {
uint8_t a[4];
} Foo__________u8__________4;

void root(Boo x);

void my_function(struct Foo__________u8__________4 x);
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer_both.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ typedef struct Foo_____u8 {

typedef struct Foo_____u8 Boo;

typedef struct Foo__________u8__________4 {
uint8_t a[4];
} Foo__________u8__________4;

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

void root(Boo x);

void my_function(struct Foo__________u8__________4 x);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer_tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ struct Foo_____u8 {

typedef struct Foo_____u8 Boo;

struct Foo__________u8__________4 {
uint8_t a[4];
};

void root(Boo x);

void my_function(struct Foo__________u8__________4 x);
6 changes: 6 additions & 0 deletions tests/expectations/generic_pointer_tag.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ struct Foo_____u8 {

typedef struct Foo_____u8 Boo;

struct Foo__________u8__________4 {
uint8_t a[4];
};

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

void root(Boo x);

void my_function(struct Foo__________u8__________4 x);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
5 changes: 5 additions & 0 deletions tests/expectations/generic_pointer_tag.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ cdef extern from *:

ctypedef Foo_____u8 Boo;

cdef struct Foo__________u8__________4:
uint8_t a[4];

void root(Boo x);

void my_function(Foo__________u8__________4 x);
3 changes: 3 additions & 0 deletions tests/rust/generic_pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ pub type Boo = Foo<*mut u8>;
pub extern "C" fn root(
x: Boo,
) { }

#[no_mangle]
pub extern "C" fn my_function(x: Foo<[u8; 4]>) {}

0 comments on commit dce986b

Please sign in to comment.