]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Generated SimpleType structs don't have a type id
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 9 Jan 2022 18:49:27 +0000 (19:49 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 9 Jan 2022 18:50:41 +0000 (19:50 +0100)
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

codegen/valaccodestructmodule.vala

index d9577e7df14bea80c0a14308362862a2992f6e0d..9c1e713107002dede9f77c2e51f5149a4b0de753 100644 (file)
@@ -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 ()) {