[Cffi-devel] cffi-grovel bitfield

Frank fau at riseup.net
Sat Jan 17 09:27:48 UTC 2015


Given this C code:

enum uv_tcp_flags {
  /* Used with uv_tcp_bind, when an IPv6 address is used. */
  UV_TCP_IPV6ONLY = 1
};

The following cffi-grovel form fails:

(bitfield (uv-tcp-flags)
  ((:ipv6-only "UV_TCP_IPV6ONLY")))

The C-file generated by cffi-grovel looks like this:

/* bitfield section for UV-TCP-FLAGS */
fputs("(cffi:defbitfield (", output);
fputs("uv-tcp-flags", output);
fputs(")", output);
fputs("\n  (", output);
fputs(":ipv6-only", output);
fputs(" ", output);
#ifdef UV_TCP_IPV6ONLY
fprintf(output, "%d", UV_TCP_IPV6ONLY);
#else
fputs("\n  #.(cl:progn (cl:warn 'cffi-grovel:missing-definition :name
'IPV6-ONLY) -1)", output);
#endif
fputs(")", output);
fputs(")\n", output);

Obviously the #ifdef guard is the culprit here.  Maybe you guys want to
fix this?






More information about the cffi-devel mailing list