]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Default to void-return for vfunc pointer cast of *_async methods
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Feb 2017 17:40:59 +0000 (18:40 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Feb 2017 17:45:33 +0000 (18:45 +0100)
This make it match vala's generated code of async-module.

To properly account for non-void *_async methods we require some additional
metadata since only the return-type of *_finish method is known.

codegen/valagtypemodule.vala

index 8945d076655345a12f0541928b5428556a87344e..11d2f6d48b5f1e85234fba5fc9d31a45653610f1 100644 (file)
@@ -1502,7 +1502,7 @@ public class Vala.GTypeModule : GErrorModule {
        CCodeExpression cast_method_pointer (Method m, CCodeExpression cfunc, ObjectTypeSymbol base_type, int direction = 3) {
                // Cast the function pointer to match the interface
                string cast;
-               if (m.return_type.is_real_non_null_struct_type ()) {
+               if (direction == 1 || m.return_type.is_real_non_null_struct_type ()) {
                        cast = "void (*)";
                } else {
                        cast = "%s (*)".printf (get_ccode_name (m.return_type));