Skip to content

Commit

Permalink
Corrected comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aodinokov committed Aug 17, 2024
1 parent 49a6836 commit 8507e60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 2 additions & 3 deletions examples/c_ffi_call/value_ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,8 @@ static int _call_wrapper(metac_value_t * p_param_storage_val, void (*fn)(void),

// idea: check all params
// if we see 0 va_list - call directly.
// if we see 1 va_list - call special wrapper and
// put va_list-internals as ... arg. Wrapper will convert .. to va_list and we can feed it to call
// if we see more than 1 - we currently don't support this.
// if we see 1 or more va_list - call special ffi wrapper and
// put va_list-internals as ... arg. Wrapper will convert ... to va_list and we can feed it to call
int metac_value_call(metac_value_t * p_param_storage_val, void (*fn)(void), metac_value_t * p_res_value) {
_check_(
p_param_storage_val == NULL ||
Expand Down
14 changes: 12 additions & 2 deletions examples/c_ffi_call/value_ffi_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,21 @@ METAC_START_TEST(test_variadic_arg) {
metac_tag_map_delete(p_tagmap);
}END_TEST

// this test doesn't work on x86 linux.. though works on big-endian linux
// WARNING: this test doesn't work on x86 linux.. though works on big-endian linux
// getting
//value_ffi_test.c:804:F:default:test_variadic_list:0: called: got test_function_with_va_list
// 6c76 726d2f65 2d73762f 63617073 2f636174 2f656475, expected test_function_with_va_list 1 2 3 4 5 6
// even though I'm getting debug dbg0: 1 2 3 4 5 6 before calling ffi_call
// and even after. looks like I'm not clear on how to pass va_list... current implementation works
// like it's a struct
/*
values[i] = &p_val_list_entries[va_list_number_cur].va_list_c.parameters;
va_list cp;
va_copy(cp, p_val_list_entries[va_list_number_cur].va_list_c.parameters);
vfprintf(stderr, "dbg0: %x %x %x %x %x %x\n", cp);
va_end(cp);
*/
// that means that we can' pass va_list as argument, because we can't use it when we call fn.

#if __linux__
START_TEST(test_variadic_list) {
Expand Down Expand Up @@ -815,7 +826,6 @@ METAC_START_TEST(test_variadic_list) {
free(s);

_CALL_PROCESS_END

);

metac_tag_map_delete(p_tagmap);
Expand Down

0 comments on commit 8507e60

Please sign in to comment.