1.1 --- a/interface.c Sat Apr 25 12:35:48 2020 +0200
1.2 +++ b/interface.c Sat Apr 25 15:43:49 2020 +0200
1.3 @@ -145,8 +145,13 @@
1.4
1.5 /* Emit a conversion macro for compound interface dispatch. */
1.6
1.7 - if (!cpp && !client)
1.8 - fprintf(fp, compound_interface_conversion, name, name, name, name);
1.9 + if (!client)
1.10 + {
1.11 + if (cpp)
1.12 + fprintf(fp, compound_interface_conversion_cpp, name);
1.13 + else
1.14 + fprintf(fp, compound_interface_conversion_c, name, name, name, name);
1.15 + }
1.16
1.17 free(class_name);
1.18 }
2.1 --- a/templates.h Sat Apr 25 12:35:48 2020 +0200
2.2 +++ b/templates.h Sat Apr 25 15:43:49 2020 +0200
2.3 @@ -137,9 +137,12 @@
2.4 #define compound_ref_type_definition_epilogue_c \
2.5 "} ref_%s;\n"
2.6
2.7 -#define compound_interface_conversion \
2.8 +#define compound_interface_conversion_c \
2.9 "\n#define convert_to_%s(_self) (&((%s) {.iface=_self->iface->to_%s, .ref=_self->ref.as_%s}))\n"
2.10
2.11 +#define compound_interface_conversion_cpp \
2.12 +"\n#define convert_to_%s(_self) (_self)\n"
2.13 +
2.14 /* Dispatch functions. */
2.15
2.16 #define dispatch_function_signature \