]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Ensure to not generate empty C structs, patch by Jared Moore, fixes bug
authorJuerg Billeter <j@bitron.ch>
Wed, 28 May 2008 19:35:06 +0000 (19:35 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 28 May 2008 19:35:06 +0000 (19:35 +0000)
2008-05-28  Juerg Billeter  <j@bitron.ch>

* gobject/valaccodeclassbinding.vala:

Ensure to not generate empty C structs,
patch by Jared Moore, fixes bug 533977

svn path=/trunk/; revision=1468

ChangeLog
gobject/valaccodeclassbinding.vala

index 28cd6bef1d460011bbb3807d08100fec94668360..67f6bb614c3bf586267550b1766088be6f593bb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-05-28  Jürg Billeter  <j@bitron.ch>
+
+       * gobject/valaccodeclassbinding.vala:
+
+       Ensure to not generate empty C structs,
+       patch by Jared Moore, fixes bug 533977
+
 2008-05-28  Jürg Billeter  <j@bitron.ch>
 
        * vala/valaconstant.vala:
index b2f104bd5864bc46d5e54c35492664f9e8b5fc2f..e508475b85a4c6491e5ee620d47d2aa32cc87066 100644 (file)
@@ -111,6 +111,11 @@ public class Vala.CCodeClassBinding : CCodeObjectTypeSymbolBinding {
                        codegen.instance_struct.add_field ("volatile int", "ref_count");
                }
 
+               if (cl.is_compact && cl.base_class == null && cl.get_fields ().size == 0) {
+                       // add dummy member, C doesn't allow empty structs
+                       codegen.instance_struct.add_field ("int", "dummy");
+               }
+
                if (is_gtypeinstance) {
                        if (cl.source_reference.file.cycle == null) {
                                decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (codegen.type_struct.name), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));