]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Improve adding of delegate target type declaration
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 21 Nov 2018 19:20:59 +0000 (20:20 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 21 Nov 2018 19:22:28 +0000 (20:22 +0100)
codegen/valaccodebasemodule.vala
codegen/valaccodedelegatemodule.vala
vapi/glib-2.0.vapi

index a1fe8b3a07704e9c2301eb795e670cef45b2800d..1f43dcb130112875c8a4f43c0af99384c19a0ecc 100644 (file)
@@ -506,7 +506,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        dbus_proxy_type = (TypeSymbol) glib_ns.scope.lookup ("DBusProxy");
 
-                       delegate_target_type = new CType ("gpointer");
+                       delegate_target_type = new StructValueType ((Struct) glib_ns.scope.lookup ("pointer"));
                        destroy_notify = (Delegate) glib_ns.scope.lookup ("DestroyNotify");
                        delegate_target_destroy_type = new DelegateType (destroy_notify);
                } else {
index a3170b835d5006727f2f3b04a76f35b49fa3f714..fe1d6f6ce992bb5699da22251163a0697dc153a0 100644 (file)
@@ -37,6 +37,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                        return;
                }
 
+               generate_type_declaration (new DelegateType (d), decl_space);
+
                string return_type_cname = get_ccode_name (d.return_type);
 
                if (d.return_type.is_real_non_null_struct_type ()) {
index 339020f15f505362cf82afa228d7f9b52bfe3b1a..67c7f1c1cb038086831da647805b0b7e1f818737 100644 (file)
@@ -1563,6 +1563,12 @@ public class string16 {
 
 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", gir_version = "2.0")]
 namespace GLib {
+       [PointerType]
+       [GIR (fullname = "gpointer")]
+       [CCode (cname = "gpointer", const_cname = "gconstpointer", cheader_filename = "glib.h")]
+       public struct pointer {
+       }
+
        [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
        namespace Math {
                [CCode (cname = "G_E")]