diff --git a/tests/expectations/va_list.c b/tests/expectations/va_list.c index d2f9ac39..1e0b4663 100644 --- a/tests/expectations/va_list.c +++ b/tests/expectations/va_list.c @@ -3,6 +3,25 @@ #include #include +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +typedef struct { + int32_t (*fn1)(va_list); +} Interface_______i32_______va_list; + +typedef struct { + int32_t (*fn1)(void); +} Interface_______i32; + int32_t va_list_test(va_list ap); int32_t va_list_test2(va_list ap); + +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + Interface_______i32_______va_list fn5, + Interface_______i32 fn6); diff --git a/tests/expectations/va_list.compat.c b/tests/expectations/va_list.compat.c index b6a444f0..40109bb4 100644 --- a/tests/expectations/va_list.compat.c +++ b/tests/expectations/va_list.compat.c @@ -3,6 +3,18 @@ #include #include +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +typedef struct { + int32_t (*fn1)(va_list); +} Interface_______i32_______va_list; + +typedef struct { + int32_t (*fn1)(void); +} Interface_______i32; + #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -11,6 +23,13 @@ int32_t va_list_test(va_list ap); int32_t va_list_test2(va_list ap); +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + Interface_______i32_______va_list fn5, + Interface_______i32 fn6); + #ifdef __cplusplus } // extern "C" #endif // __cplusplus diff --git a/tests/expectations/va_list.cpp b/tests/expectations/va_list.cpp index 79b32c85..8988f930 100644 --- a/tests/expectations/va_list.cpp +++ b/tests/expectations/va_list.cpp @@ -4,10 +4,26 @@ #include #include +using VaListFnPtr = int32_t(*)(va_list); + +using VaListFnPtr2 = int32_t(*)(); + +template +struct Interface { + T fn1; +}; + extern "C" { int32_t va_list_test(va_list ap); int32_t va_list_test2(va_list ap); +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + Interface fn5, + Interface fn6); + } // extern "C" diff --git a/tests/expectations/va_list.pyx b/tests/expectations/va_list.pyx index 4ce0c8d7..2b8edd48 100644 --- a/tests/expectations/va_list.pyx +++ b/tests/expectations/va_list.pyx @@ -6,6 +6,23 @@ cdef extern from *: cdef extern from *: + ctypedef int32_t (*VaListFnPtr)(va_list); + + ctypedef int32_t (*VaListFnPtr2)(); + + ctypedef struct Interface_______i32_______va_list: + int32_t (*fn1)(va_list); + + ctypedef struct Interface_______i32: + int32_t (*fn1)(); + int32_t va_list_test(va_list ap); int32_t va_list_test2(va_list ap); + + void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + Interface_______i32_______va_list fn5, + Interface_______i32 fn6); diff --git a/tests/expectations/va_list_both.c b/tests/expectations/va_list_both.c new file mode 100644 index 00000000..8da67989 --- /dev/null +++ b/tests/expectations/va_list_both.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +typedef struct Interface_______i32_______va_list { + int32_t (*fn1)(va_list); +} Interface_______i32_______va_list; + +typedef struct Interface_______i32 { + int32_t (*fn1)(void); +} Interface_______i32; + +int32_t va_list_test(va_list ap); + +int32_t va_list_test2(va_list ap); + +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + struct Interface_______i32_______va_list fn5, + struct Interface_______i32 fn6); diff --git a/tests/expectations/va_list_both.compat.c b/tests/expectations/va_list_both.compat.c new file mode 100644 index 00000000..29895ded --- /dev/null +++ b/tests/expectations/va_list_both.compat.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +typedef struct Interface_______i32_______va_list { + int32_t (*fn1)(va_list); +} Interface_______i32_______va_list; + +typedef struct Interface_______i32 { + int32_t (*fn1)(void); +} Interface_______i32; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +int32_t va_list_test(va_list ap); + +int32_t va_list_test2(va_list ap); + +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + struct Interface_______i32_______va_list fn5, + struct Interface_______i32 fn6); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/va_list_tag.c b/tests/expectations/va_list_tag.c new file mode 100644 index 00000000..1dc28cbb --- /dev/null +++ b/tests/expectations/va_list_tag.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +struct Interface_______i32_______va_list { + int32_t (*fn1)(va_list); +}; + +struct Interface_______i32 { + int32_t (*fn1)(void); +}; + +int32_t va_list_test(va_list ap); + +int32_t va_list_test2(va_list ap); + +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + struct Interface_______i32_______va_list fn5, + struct Interface_______i32 fn6); diff --git a/tests/expectations/va_list_tag.compat.c b/tests/expectations/va_list_tag.compat.c new file mode 100644 index 00000000..ba2da4fa --- /dev/null +++ b/tests/expectations/va_list_tag.compat.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +typedef int32_t (*VaListFnPtr)(va_list); + +typedef int32_t (*VaListFnPtr2)(void); + +struct Interface_______i32_______va_list { + int32_t (*fn1)(va_list); +}; + +struct Interface_______i32 { + int32_t (*fn1)(void); +}; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +int32_t va_list_test(va_list ap); + +int32_t va_list_test2(va_list ap); + +void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(void), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + struct Interface_______i32_______va_list fn5, + struct Interface_______i32 fn6); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/va_list_tag.pyx b/tests/expectations/va_list_tag.pyx new file mode 100644 index 00000000..5b7ccca4 --- /dev/null +++ b/tests/expectations/va_list_tag.pyx @@ -0,0 +1,28 @@ +from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t +cdef extern from *: + ctypedef bint bool + ctypedef struct va_list + +cdef extern from *: + + ctypedef int32_t (*VaListFnPtr)(va_list); + + ctypedef int32_t (*VaListFnPtr2)(); + + cdef struct Interface_______i32_______va_list: + int32_t (*fn1)(va_list); + + cdef struct Interface_______i32: + int32_t (*fn1)(); + + int32_t va_list_test(va_list ap); + + int32_t va_list_test2(va_list ap); + + void va_list_fn_ptrs(int32_t (*fn1)(va_list), + int32_t (*fn2)(), + VaListFnPtr fn3, + VaListFnPtr2 fn4, + Interface_______i32_______va_list fn5, + Interface_______i32 fn6); diff --git a/tests/rust/va_list.rs b/tests/rust/va_list.rs index 13503dda..e57178eb 100644 --- a/tests/rust/va_list.rs +++ b/tests/rust/va_list.rs @@ -9,3 +9,22 @@ pub unsafe extern "C" fn va_list_test(mut ap: VaList) -> int32_t { pub unsafe extern "C" fn va_list_test2(mut ap: ...) -> int32_t { ap.arg() } + +type VaListFnPtr = Option int32_t>; +type VaListFnPtr2 = Option int32_t>; + +#[repr(C)] +struct Interface { + fn1: T, +} + +#[no_mangle] +pub extern "C" fn va_list_fn_ptrs( + fn1: Option int32_t>, + fn2: Option int32_t>, + fn3: VaListFnPtr, + fn4: VaListFnPtr2, + fn5: Interface int32_t>>, + fn6: Interface int32_t>>, +) { +}