From: Michal Hruby Date: Wed, 27 Jul 2011 18:34:51 +0000 (+0200) Subject: Fix a gcc warning when returning struct in an interface method X-Git-Tag: 0.13.2~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54fb848f760496952c156a9c5aab05aa56051164;p=thirdparty%2Fvala.git Fix a gcc warning when returning struct in an interface method --- diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index cf2755e83..0c82c0dfb 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -1459,7 +1459,12 @@ public class Vala.GTypeModule : GErrorModule { CCodeExpression cast_method_pointer (Method m, CCodeExpression cfunc, ObjectTypeSymbol base_type) { // Cast the function pointer to match the interface - string cast = m.return_type.get_cname () + " (*)"; + string cast; + if (m.return_type.is_real_non_null_struct_type ()) { + cast = "void (*)"; + } else { + cast = m.return_type.get_cname () + " (*)"; + } string cast_args = base_type.get_cname () + "*"; var vdeclarator = new CCodeFunctionDeclarator (m.vfunc_name);