-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for function pointer text wrapping.
- Loading branch information
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <cstdarg> | ||
#include <cstdint> | ||
#include <cstdlib> | ||
#include <ostream> | ||
#include <new> | ||
|
||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pub type MyCallback = Option<unsafe extern "C" fn(a: usize, b: usize)>; | ||
|
||
pub type MyOtherCallback = Option<unsafe extern "C" fn(a: usize, lot: usize, of: usize, args: usize, and_then_some: usize)>; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn my_function(a: MyCallback, b: MyOtherCallback) {} |