summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2022-01-09 19:49:27 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2022-01-09 19:50:41 +0100
commit590e041f02cb723bd499af6183af403b8fcf68a4 (patch)
tree5f2184a2e24b1db184b8c4b09ce854a65fe59627
parente73a038895c2f79555bae2bf5a4c25bd345a823f (diff)
downloadvala-590e041f02cb723bd499af6183af403b8fcf68a4.tar.gz
codegen: Generated SimpleType structs don't have a type id
Set "CCode.has_type_id" in CCodeStructModule.generate_struct_declaration() like in GTypeModule.visit_struct() for SimpleType structs which might be executed too late. In addition to 2e798fc3f8e9af25a4c231c2561894d9f0a0be50
-rw-r--r--codegen/valaccodestructmodule.vala5
1 files changed, 5 insertions, 0 deletions
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index d9577e7df..9c1e71310 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -32,6 +32,11 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
if (st.base_struct != null) {
generate_struct_declaration (st.base_struct, decl_space);
+ } else if (!st.external_package) {
+ // custom simple type structs cannot have a type id which depends on head-allocation
+ if (st.get_attribute ("SimpleType") != null && !st.has_attribute_argument ("CCode", "type_id")) {
+ st.set_attribute_bool ("CCode", "has_type_id", false);
+ }
}
if (st.is_boolean_type () || st.is_integer_type () || st.is_floating_type ()) {