Alignment not supported?

Florian Weimer fw@deneb.enyo.de
Sun Jan 1 00:00:00 GMT 2017


* David Malcolm:

> My first thought was that we could add a way to expose attributes on types from the API, something like:
>
> extern gcc_jit_type *
> gcc_jit_type_add_attribute (gcc_jit_type *type,
>                             const char *attribute_name,
>                             /* some extra params */ );
>
> but it's not clear to me what those extra params should look like here.
>
> It could be variadic, but variadic functions make for an error-prone
> API that's easy to crash, and they're a pain to deal with in
> language bindings.

Right, please don't do that. :)

> Maybe:
>
> extern gcc_jit_type *
> gcc_jit_type_add_attribute_int (gcc_jit_type *type,
>                                 const char *attribute_name,
>                                 int attr_param);
>
> (perhaps adding other suffixes for other type signatures; this is a
> C API, so there we can't use overloads; the C++ bindings could use
> them, though).

I would suggest to model the interface after gcc_jit_context_new_call
(but still keep it separate because even though attributes with
arguments are syntactically pretty much like function calls in the C
front end, semantically, they are not).

I'm not sure where the argument list checking for attributes happens
(at least it's not part of the C parser).  It would be preferable if
there were at least some consistency checks when using the JIT
interface, instead of silently generating broken code.



More information about the Jit mailing list