]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix a gcc warning when returning struct in an interface method
authorMichal Hruby <michal.mhr@gmail.com>
Wed, 27 Jul 2011 18:34:51 +0000 (20:34 +0200)
committerMichal Hruby <michal.mhr@gmail.com>
Wed, 27 Jul 2011 18:36:16 +0000 (20:36 +0200)
codegen/valagtypemodule.vala

index cf2755e836267436091e554db79679c9f2e83c58..0c82c0dfb6471b8e5d33035e79c58c2c85b4b331 100644 (file)
@@ -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);