[vala/0.36] codegen: Emit struct declaration typedef before resolving its fields
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] codegen: Emit struct declaration typedef before resolving its fields
- Date: Thu, 28 Feb 2019 17:39:58 +0000 (UTC)
commit 8f433516c0d56a28d431b9415d5e8237b58437dc
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Jan 10 20:02:39 2019 +0100
codegen: Emit struct declaration typedef before resolving its fields
This a regression when compiling a circular dependency of delegates with
structs.
Regression of 7adb3a45bb8d663c0cfca55af26b7e6f7292b14a
See https://gitlab.gnome.org/GNOME/vala/issues/318
codegen/valaccodestructmodule.vala | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index b1f160c1d..66b8fe33a 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -64,6 +64,12 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
decl_space.add_type_member_declaration (type_fun.get_declaration ());
}
+ if (st.base_struct == null) {
+ decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf
(get_ccode_name (st)), new CCodeVariableDeclarator (get_ccode_name (st))));
+ } else {
+ decl_space.add_type_declaration (new CCodeTypeDefinition (get_ccode_name
(st.base_struct), new CCodeVariableDeclarator (get_ccode_name (st))));
+ }
+
var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (st)));
instance_struct.modifiers |= (st.version.deprecated ? CCodeModifiers.DEPRECATED : 0);
@@ -107,11 +113,7 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
}
if (st.base_struct == null) {
- decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf
(get_ccode_name (st)), new CCodeVariableDeclarator (get_ccode_name (st))));
-
decl_space.add_type_definition (instance_struct);
- } else {
- decl_space.add_type_declaration (new CCodeTypeDefinition (get_ccode_name
(st.base_struct), new CCodeVariableDeclarator (get_ccode_name (st))));
}
var function = new CCodeFunction (get_ccode_dup_function (st), get_ccode_name (st) + "*");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]