diff --git a/tests/expectations/function_ptr.c b/tests/expectations/function_ptr.c new file mode 100644 index 0000000..1041a6b --- /dev/null +++ b/tests/expectations/function_ptr.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +typedef void (*MyCallback)(uintptr_t a, uintptr_t b); + +typedef void (*MyOtherCallback)(uintptr_t a, + uintptr_t lot, + uintptr_t of, + uintptr_t args, + uintptr_t and_then_some); + +void my_function(MyCallback a, MyOtherCallback b); diff --git a/tests/expectations/function_ptr.compat.c b/tests/expectations/function_ptr.compat.c new file mode 100644 index 0000000..be3870c --- /dev/null +++ b/tests/expectations/function_ptr.compat.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +typedef void (*MyCallback)(uintptr_t a, uintptr_t b); + +typedef void (*MyOtherCallback)(uintptr_t a, + uintptr_t lot, + uintptr_t of, + uintptr_t args, + uintptr_t and_then_some); + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void my_function(MyCallback a, MyOtherCallback b); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/function_ptr.cpp b/tests/expectations/function_ptr.cpp new file mode 100644 index 0000000..217a160 --- /dev/null +++ b/tests/expectations/function_ptr.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +using MyCallback = void(*)(uintptr_t a, uintptr_t b); + +using MyOtherCallback = void(*)(uintptr_t a, + uintptr_t lot, + uintptr_t of, + uintptr_t args, + uintptr_t and_then_some); + +extern "C" { + +void my_function(MyCallback a, MyOtherCallback b); + +} // extern "C" diff --git a/tests/expectations/function_ptr.pyx b/tests/expectations/function_ptr.pyx new file mode 100644 index 0000000..3717742 --- /dev/null +++ b/tests/expectations/function_ptr.pyx @@ -0,0 +1,17 @@ +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 void (*MyCallback)(uintptr_t a, uintptr_t b); + + ctypedef void (*MyOtherCallback)(uintptr_t a, + uintptr_t lot, + uintptr_t of, + uintptr_t args, + uintptr_t and_then_some); + + void my_function(MyCallback a, MyOtherCallback b); diff --git a/tests/rust/function_ptr.rs b/tests/rust/function_ptr.rs new file mode 100644 index 0000000..59adb52 --- /dev/null +++ b/tests/rust/function_ptr.rs @@ -0,0 +1,6 @@ +pub type MyCallback = Option; + +pub type MyOtherCallback = Option; + +#[no_mangle] +pub extern "C" fn my_function(a: MyCallback, b: MyOtherCallback) {}