ccall.add_argument (new CCodeConstant ("NULL"));
ccall.add_argument (new CCodeConstant ("NULL"));
}
+
if (m.return_type is VoidType || m.return_type.is_real_non_null_struct_type ()) {
ccode.add_expression (ccall);
+ if (!(d.return_type is VoidType || d.return_type.is_real_non_null_struct_type ())) {
+ // return a default value
+ ccode.add_declaration (return_type_cname, new CCodeVariableDeclarator ("result", default_value_for_type (d.return_type, true)));
+ }
} else {
CCodeExpression result = ccall;
if (d.return_type is GenericType) {
}
}
- if (!(m.return_type is VoidType || m.return_type.is_real_non_null_struct_type ())) {
+ if (!(m.return_type is VoidType || m.return_type.is_real_non_null_struct_type ()) ||
+ !(d.return_type is VoidType || d.return_type.is_real_non_null_struct_type ())) {
ccode.add_return (new CCodeIdentifier ("result"));
}