From cf2a6d04c9722fed956548f32926eb53f3c1be78 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrg=20Billeter?= Date: Thu, 26 Oct 2006 12:05:44 +0000 Subject: [PATCH] don't create empty dispose functions, support virtual methods with MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2006-10-26 Jürg Billeter * vala/valacodegenerator.vala: don't create empty dispose functions, support virtual methods with non-void return type * vapi/glib-2.0.vala: include glib/gstdio.h for GLib file functions svn path=/trunk/; revision=156 --- vala/ChangeLog | 6 ++++++ vala/vala/valacodegenerator.vala | 9 +++++++-- vala/vapi/glib-2.0.vala | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/vala/ChangeLog b/vala/ChangeLog index a1fa3f1..1b83680 100644 --- a/vala/ChangeLog +++ b/vala/ChangeLog @@ -1,5 +1,11 @@ 2006-10-26 Jürg Billeter + * vala/valacodegenerator.vala: don't create empty dispose functions, + support virtual methods with non-void return type + * vapi/glib-2.0.vala: include glib/gstdio.h for GLib file functions + +2006-10-26 Jürg Billeter + * vala/valacodegenerator.vala: explicitly cast callbacks to reduce the number of warnings during C compilation diff --git a/vala/vala/valacodegenerator.vala b/vala/vala/valacodegenerator.vala index 6e910b4..bb7bfe0 100644 --- a/vala/vala/valacodegenerator.vala +++ b/vala/vala/valacodegenerator.vala @@ -410,7 +410,7 @@ public class Vala.CodeGenerator : CodeVisitor { } add_instance_init_function (cl); - if (memory_management) { + if (memory_management && cl.get_fields () != null) { add_dispose_function (cl); } @@ -1273,7 +1273,12 @@ public class Vala.CodeGenerator : CodeVisitor { vcall.add_argument (new CCodeIdentifier (param.name)); } - vblock.add_statement (new CCodeExpressionStatement (vcall)); + if (m.return_type.data_type == null) { + vblock.add_statement (new CCodeExpressionStatement (vcall)); + } else { + /* pass method return value */ + vblock.add_statement (new CCodeReturnStatement (vcall)); + } header_type_member_declaration.append (vfunc.copy ()); diff --git a/vala/vapi/glib-2.0.vala b/vala/vapi/glib-2.0.vala index 632114b..0c74b6e 100644 --- a/vala/vapi/glib-2.0.vala +++ b/vala/vapi/glib-2.0.vala @@ -757,7 +757,7 @@ namespace GLib { } [ReferenceType (free_function = "fclose")] - [CCode (cname = "FILE", cheader_filename = "stdio.h")] + [CCode (cname = "FILE", cheader_filename = "stdio.h,glib/gstdio.h")] public struct File { [CCode (cname = "fopen")] public static ref File open (string path, string mode); -- 2.7.4