[Vala] Patch: allow TypeSymbols in emitted C code for some C library macros



The attached patch to vala 0.3.5 allows vala to emit naked type symbols
as arguments to ellipses functions.
(The ellipses is really a red-herring, but it is currently the favoured
way to pass non-type-checked arguments to library macros which vala is
wrapping as functions - maybe some work could be done on "void" here, or
"any" [like python] for un-type-checked arguments)

This function is useful when a macro wants the C type passing, generally
for stringifying or casting; I particularly need it to make use of this
Samba4 talloc library macro:

#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type),
#type)

which is a pretty darn useful macro, wrapped with this vapi:
  [CCode (sentinel="")]
  public void* zero(void* mem_ctx, ...);

NOTE: only one of the fragment for
gobject/valaccodeinvocationexpressionbinding.vala
and
gobject/valaccodegenerator.vala
is needed.

valaccodeinvocationexpressionbinding has the most specific patch only
covering the ellipses case in method invocation generation,
valaccodegenerator has a more general case and triggers quite often and
so for all I know has some broader side effects.

Comments?

Sam



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]