Method::print_fd_arg_list: skip user pointer arguments
commit51a178400cbb583b0090d60cf18b8ec1aa23e7ad
authorSven Verdoolaege <sven@cerebras.net>
Wed, 31 Mar 2021 12:23:13 +0000 (31 14:23 +0200)
committerSven Verdoolaege <sven@cerebras.net>
Mon, 6 Sep 2021 20:36:15 +0000 (6 22:36 +0200)
tree7278581bd93a2cd925fbd33341ec747379d95616
parente0f8e207971a1727b03e6bbadb9ff1d9bea9d7d0
Method::print_fd_arg_list: skip user pointer arguments

Currently, the number of arguments is reduced by one in call
of a callback, meaning that the (presumed unique) user pointer
is never considered by Method::print_arg.
However, this only works if there is only a single callback
(and there are no other arguments following the callback and
the user pointer).
To be able to support exported functions with multiple callbacks
(each with its own user pointer), a user pointer needs
to be skipped for every callback argument.

Replace the "print_arg" callback of Method::print_arg_list
by a "print_arg_skip_next" that indicates whether the next
argument should be skipped.
Method::print_fd_arg_list uses this callback to skip
the user pointers following the callbacks in the exported functions.
print_callback_args in template_cpp.cc does not skip
any arguments since it is responsible for printing a callback and
callbacks are assumed not to have any callback arguments themselves.

Signed-off-by: Sven Verdoolaege <sven@cerebras.net>
interface/cpp.cc
interface/cpp.h
interface/template_cpp.cc