[vala] Fix a gcc warning when returning struct in an interface method



commit 54fb848f760496952c156a9c5aab05aa56051164
Author: Michal Hruby <michal mhr gmail com>
Date:   Wed Jul 27 20:34:51 2011 +0200

    Fix a gcc warning when returning struct in an interface method

 codegen/valagtypemodule.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index cf2755e..0c82c0d 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]