Test Export
include/test/export.h View source View on GitHubStructs
Section titled “Structs”test_export_entry
Section titled “test_export_entry”test_import_entry
Section titled “test_import_entry” struct test_import_entry (4 fields) source
test_signature_record
Section titled “test_signature_record” struct test_signature_record (5 fields) source
Macros
Section titled “Macros”TEST_EXPORT_AS
Section titled “TEST_EXPORT_AS”#define TEST_EXPORT_AS(sym_name, export_fn) source Expansion
#define TEST_EXPORT_AS(sym_name, export_fn) \
extern typeof(export_fn) __test_sym_##sym_name cc_alias(export_fn) \
cc_used; \
static LINKER_SECTION_OBJECT(const struct test_export_entry, test_exports) \
__test_exp_##sym_name = { \
.name = #sym_name, \
.fn = any_fn_from(export_fn), \
} TEST_EXPORT
Section titled “TEST_EXPORT”#define TEST_EXPORT(fn) source Expansion
#define TEST_EXPORT(fn) TEST_EXPORT_AS(fn, fn) TEST_IMPORT
Section titled “TEST_IMPORT”#define TEST_IMPORT(ret, fn, ...) source Expansion
#define TEST_IMPORT(ret, fn, ...) \
ret __test_sym_##fn(__VA_ARGS__); \
static LINKER_SECTION_OBJECT(const struct test_signature_record, \
test_canonical_signatures) \
__test_sig_##fn = { \
.name = #fn, \
.ret_str = #ret, \
.args_str = #__VA_ARGS__, \
.file = __FILE__, \
.line = __LINE__, \
} TEST_IMPORT_UNSAFE
Section titled “TEST_IMPORT_UNSAFE”#define TEST_IMPORT_UNSAFE(ret, sym_name, ...) source Expansion
#define TEST_IMPORT_UNSAFE(ret, sym_name, ...) \
typedef ret (*__test_unsafe_fn_t_##sym_name)(__VA_ARGS__); \
static any_fn_t __test_unsafe_fn_##sym_name; \
static LINKER_SECTION_OBJECT(const struct test_import_entry, test_imports) \
__test_imp_##sym_name = { \
.name = #sym_name, \
.target_fn = &__test_unsafe_fn_##sym_name, \
.import_file = __FILE__, \
.import_line = __LINE__, \
}; \
static LINKER_SECTION_OBJECT(const struct test_signature_record, \
test_unsafe_signatures) \
__test_unsig_##sym_name = { \
.name = #sym_name, \
.ret_str = #ret, \
.args_str = #__VA_ARGS__, \
.file = __FILE__, \
.line = __LINE__, \
} TEST_CALL
Section titled “TEST_CALL”TEST_CALL_UNSAFE
Section titled “TEST_CALL_UNSAFE”#define TEST_CALL_UNSAFE(sym_name) source Expansion
#define TEST_CALL_UNSAFE(sym_name) \
any_fn_to(__test_unsafe_fn_##sym_name, __test_unsafe_fn_t_##sym_name) TEST_EXPORT
Section titled “TEST_EXPORT”#define TEST_EXPORT(fn) source Expansion
#define TEST_EXPORT(fn) TEST_IMPORT
Section titled “TEST_IMPORT”#define TEST_IMPORT(ret, fn, ...) source Expansion
#define TEST_IMPORT(ret, fn, ...) TEST_IMPORT_UNSAFE
Section titled “TEST_IMPORT_UNSAFE”#define TEST_IMPORT_UNSAFE(ret, sym_name, ...) source Expansion
#define TEST_IMPORT_UNSAFE(ret, sym_name, ...) TEST_CALL
Section titled “TEST_CALL”TEST_CALL_UNSAFE
Section titled “TEST_CALL_UNSAFE”#define TEST_CALL_UNSAFE(sym_name) source Expansion
#define TEST_CALL_UNSAFE(sym_name) (void)