Skip to content

Commit

Permalink
Improved test coverage of va_list
Browse files Browse the repository at this point in the history
  • Loading branch information
gerard-ryan-immersaview committed May 27, 2024
1 parent 822bde0 commit 887da03
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/expectations/va_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
#include <stdint.h>
#include <stdlib.h>

typedef int32_t (*VaListFnPtr)(va_list);

typedef int32_t (*VaListFnPtr2)(va_list);

int32_t va_list_test(va_list ap);

int32_t va_list_test2(va_list ap);

void va_list_fn_ptrs(int32_t (*ptr1)(va_list),
int32_t (*ptr2)(va_list),
VaListFnPtr ptr3,
VaListFnPtr2 ptr4);
9 changes: 9 additions & 0 deletions tests/expectations/va_list.compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <stdint.h>
#include <stdlib.h>

typedef int32_t (*VaListFnPtr)(va_list);

typedef int32_t (*VaListFnPtr2)(va_list);

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
Expand All @@ -11,6 +15,11 @@ int32_t va_list_test(va_list ap);

int32_t va_list_test2(va_list ap);

void va_list_fn_ptrs(int32_t (*ptr1)(va_list),
int32_t (*ptr2)(va_list),
VaListFnPtr ptr3,
VaListFnPtr2 ptr4);

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
9 changes: 9 additions & 0 deletions tests/expectations/va_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@
#include <ostream>
#include <new>

using VaListFnPtr = int32_t(*)(va_list);

using VaListFnPtr2 = int32_t(*)(va_list);

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 (*ptr1)(va_list),
int32_t (*ptr2)(va_list),
VaListFnPtr ptr3,
VaListFnPtr2 ptr4);

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

cdef extern from *:

ctypedef int32_t (*VaListFnPtr)(va_list);

ctypedef int32_t (*VaListFnPtr2)(va_list);

int32_t va_list_test(va_list ap);

int32_t va_list_test2(va_list ap);

void va_list_fn_ptrs(int32_t (*ptr1)(va_list),
int32_t (*ptr2)(va_list),
VaListFnPtr ptr3,
VaListFnPtr2 ptr4);
12 changes: 12 additions & 0 deletions tests/rust/va_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ 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<unsafe extern "C" fn(VaList) -> int32_t>;
type VaListFnPtr2 = Option<unsafe extern "C" fn(...) -> int32_t>;

#[no_mangle]
pub extern "C" fn va_list_fn_ptrs(
ptr1: Option<unsafe extern "C" fn(VaList) -> int32_t>,
ptr2: Option<unsafe extern "C" fn(...) -> int32_t>,
ptr3: VaListFnPtr,
ptr4: VaListFnPtr2,
) {
}

0 comments on commit 887da03

Please sign in to comment.