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



commit a7b176a9524749c6bdee49984ca8b8f623546030
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Aug 15 23:02:06 2017 +0200

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

 codegen/valaccodebasemodule.vala |    1 +
 tests/Makefile.am                |    1 +
 tests/enums/enum_only.vala       |    7 +++++++
 3 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 53b4229..4f53d78 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -825,6 +825,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        return true;
                }
 
+               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 (en, null));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bd3c1b6..92f3763 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -108,6 +108,7 @@ TESTS = \
        control-flow/bug661985.vala \
        control-flow/bug665904.vala \
        control-flow/bug691514.vala     \
+       enums/enum_only.vala \
        enums/enums.vala \
        enums/flags.vala \
        enums/bug673879.vala \
diff --git a/tests/enums/enum_only.vala b/tests/enums/enum_only.vala
new file mode 100644
index 0000000..195f2ab
--- /dev/null
+++ b/tests/enums/enum_only.vala
@@ -0,0 +1,7 @@
+public enum Foo {
+       BAR,
+       BAZ
+}
+
+void main () {
+}


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