skip = ""
if reg.array:
- print("#define %s(__i, ...) pack_%s(__i, (struct %s) { __VA_ARGS__ })%s\n" %
+ print("#define %s(__i, ...) pack_%s(__i, __struct_cast(%s) { __VA_ARGS__ })%s\n" %
(prefix, prefix, prefix, skip))
else:
- print("#define %s(...) pack_%s((struct %s) { __VA_ARGS__ })%s\n" %
+ print("#define %s(...) pack_%s(__struct_cast(%s) { __VA_ARGS__ })%s\n" %
(prefix, prefix, prefix, skip))
print("#include <assert.h>")
print()
+ print("#ifdef __cplusplus");
+ print("#define __struct_cast(X)")
+ print("#else")
+ print("#define __struct_cast(X) (struct X)")
+ print("#endif")
+
try:
p.parse(rnn_path, xml_file)
except Error as e: