This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [PATCH] Add variadic support
On 2011/2/24, Chung-Lin Tang wrote:
>>> I suggest moving the nfixedargs field into the ARM FFI_EXTRA_CIF_FIELDS,
>>> >> placed after the current VFP fields; this means doing away with the
>>> >> FFI_TARGET_SPECIFIC_VARIADIC symbol, and probably having a
>>> >> machine-specific ffi_prep_cif_var_machdep() function, analogous to the
>>> >> current ffi_prep_cif_machdep().
>> >
>> > That would mean changing every back end to add that function or again
> Okay, then we should keep the preprocessor symbol then; we can then use
> the basic ffi_prep_cif() as the default ffi_prep_cif_var() implementation.
>
I just wanted to add that, instead of a new ffi_prep_cif_var_machdep()
function for all backends to add, thus needing a preprocessor symbol to
set a 'default' implementation (to avoid changing every port), we can do
this: add a flag value, passed by cif->flags, into
ffi_prep_cif_machdep() to indicate variadic function processing. We'll
just need a new flag value CPP symbol, but avoid an ugly #ifndef in the
machine-independent code.
I'm suggesting this because I see cif->flags being overwritten anyways
by the backend ffi_prep_cif_machdep() implementations I see, so it
should be valid to pass in values for this use.
Chung-Lin