From dce986b8d0a0aac266ebdf2298274844362c56fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 27 Oct 2024 23:24:33 +0100 Subject: [PATCH] Add a test for mangling of array generics. --- tests/expectations/generic_pointer.c | 6 ++++++ tests/expectations/generic_pointer.compat.c | 6 ++++++ tests/expectations/generic_pointer.cpp | 2 ++ tests/expectations/generic_pointer.pyx | 5 +++++ tests/expectations/generic_pointer_both.c | 6 ++++++ tests/expectations/generic_pointer_both.compat.c | 6 ++++++ tests/expectations/generic_pointer_tag.c | 6 ++++++ tests/expectations/generic_pointer_tag.compat.c | 6 ++++++ tests/expectations/generic_pointer_tag.pyx | 5 +++++ tests/rust/generic_pointer.rs | 3 +++ 10 files changed, 51 insertions(+) diff --git a/tests/expectations/generic_pointer.c b/tests/expectations/generic_pointer.c index 35d430d66..d117ab5b1 100644 --- a/tests/expectations/generic_pointer.c +++ b/tests/expectations/generic_pointer.c @@ -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); diff --git a/tests/expectations/generic_pointer.compat.c b/tests/expectations/generic_pointer.compat.c index d5f3ac9c3..e294fb47e 100644 --- a/tests/expectations/generic_pointer.compat.c +++ b/tests/expectations/generic_pointer.compat.c @@ -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 diff --git a/tests/expectations/generic_pointer.cpp b/tests/expectations/generic_pointer.cpp index 8b505147f..60f11d9ea 100644 --- a/tests/expectations/generic_pointer.cpp +++ b/tests/expectations/generic_pointer.cpp @@ -15,4 +15,6 @@ extern "C" { void root(Boo x); +void my_function(Foo x); + } // extern "C" diff --git a/tests/expectations/generic_pointer.pyx b/tests/expectations/generic_pointer.pyx index 4d4e36b7a..87b040872 100644 --- a/tests/expectations/generic_pointer.pyx +++ b/tests/expectations/generic_pointer.pyx @@ -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); diff --git a/tests/expectations/generic_pointer_both.c b/tests/expectations/generic_pointer_both.c index ac51021e7..76766754a 100644 --- a/tests/expectations/generic_pointer_both.c +++ b/tests/expectations/generic_pointer_both.c @@ -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); diff --git a/tests/expectations/generic_pointer_both.compat.c b/tests/expectations/generic_pointer_both.compat.c index 5b2981c7e..39e0ea317 100644 --- a/tests/expectations/generic_pointer_both.compat.c +++ b/tests/expectations/generic_pointer_both.compat.c @@ -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 diff --git a/tests/expectations/generic_pointer_tag.c b/tests/expectations/generic_pointer_tag.c index 9c2ea9dc1..57825ca3b 100644 --- a/tests/expectations/generic_pointer_tag.c +++ b/tests/expectations/generic_pointer_tag.c @@ -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); diff --git a/tests/expectations/generic_pointer_tag.compat.c b/tests/expectations/generic_pointer_tag.compat.c index 07dee1525..dd31fcc14 100644 --- a/tests/expectations/generic_pointer_tag.compat.c +++ b/tests/expectations/generic_pointer_tag.compat.c @@ -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 diff --git a/tests/expectations/generic_pointer_tag.pyx b/tests/expectations/generic_pointer_tag.pyx index 0f541a1a1..56fb55213 100644 --- a/tests/expectations/generic_pointer_tag.pyx +++ b/tests/expectations/generic_pointer_tag.pyx @@ -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); diff --git a/tests/rust/generic_pointer.rs b/tests/rust/generic_pointer.rs index 1167c76bb..828bdc102 100644 --- a/tests/rust/generic_pointer.rs +++ b/tests/rust/generic_pointer.rs @@ -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]>) {}