[vala/0.36: 41/212] codegen: Include glib-object.h for Structs with type_id



commit 29b283a1fe2980ff7ed3082868cfd5efbe710b2b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Aug 16 09:36:52 2017 +0200

    codegen: Include glib-object.h for Structs with type_id

 codegen/valaccodestructmodule.vala |    1 +
 tests/Makefile.am                  |    1 +
 tests/structs/struct_only.vala     |    6 ++++++
 3 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 9457b35..9774570 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -54,6 +54,7 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                }
 
                if (get_ccode_has_type_id (st)) {
+                       decl_space.add_include ("glib-object.h");
                        decl_space.add_type_declaration (new CCodeNewline ());
                        var macro = "(%s_get_type ())".printf (get_ccode_lower_case_name (st, null));
                        decl_space.add_type_declaration (new CCodeMacroReplacement (get_ccode_type_id (st), 
macro));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 92f3763..2918bb6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -114,6 +114,7 @@ TESTS = \
        enums/bug673879.vala \
        enums/bug763831.vala \
        enums/bug780050.vala \
+       structs/struct_only.vala \
        structs/structs.vala \
        structs/gvalue.vala \
        structs/bug530605.vala \
diff --git a/tests/structs/struct_only.vala b/tests/structs/struct_only.vala
new file mode 100644
index 0000000..5d60a04
--- /dev/null
+++ b/tests/structs/struct_only.vala
@@ -0,0 +1,6 @@
+public struct Foo {
+       public int i;
+}
+
+void main () {
+}


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