Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
67 lines
2.9 KiB
Diff
67 lines
2.9 KiB
Diff
commit a902d7eae96a3f1ab0cb64f268443b23ee8ab45a
|
|
Author: Rico Tzschichholz <ricotz@ubuntu.com>
|
|
Date: Sat Mar 18 12:40:55 2023 +0100
|
|
|
|
codegen: Add declaration for register call of dynamic DBus interfaces
|
|
|
|
The call was added without the required extern declaration
|
|
|
|
Found by -Werror=implicit-function-declaration
|
|
|
|
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1422
|
|
|
|
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
|
|
index 77ff73c3120bcafd..6edafac6a07e7cb4 100644
|
|
--- a/codegen/valaccodemethodmodule.vala
|
|
+++ b/codegen/valaccodemethodmodule.vala
|
|
@@ -291,6 +291,12 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
|
|
}
|
|
}
|
|
|
|
+ unowned Interface? iface = type_symbol as Interface;
|
|
+ bool is_dbus_interface = false;
|
|
+ if (iface != null) {
|
|
+ is_dbus_interface = GDBusModule.get_dbus_name (type_symbol) != null;
|
|
+ }
|
|
+
|
|
// Add function prototypes for required register-type-calls which are likely external
|
|
if (type_symbol.source_reference.file != cfile.file) {
|
|
// TODO Duplicated source with TypeRegisterFunction.init_from_type()
|
|
@@ -298,22 +304,26 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
|
|
register_func.add_parameter (new CCodeParameter ("module", "GTypeModule *"));
|
|
register_func.is_declaration = true;
|
|
cfile.add_function_declaration (register_func);
|
|
+
|
|
+ // TODO Duplicated source with GDBusClientModule.generate_interface_declaration()
|
|
+ if (is_dbus_interface) {
|
|
+ var proxy_register_type = new CCodeFunction ("%sproxy_register_dynamic_type".printf (get_ccode_lower_case_prefix (iface)));
|
|
+ proxy_register_type.add_parameter (new CCodeParameter ("module", "GTypeModule*"));
|
|
+ proxy_register_type.modifiers |= CCodeModifiers.EXTERN;
|
|
+ cfile.add_function_declaration (proxy_register_type);
|
|
+ requires_vala_extern = true;
|
|
+ }
|
|
}
|
|
|
|
var register_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_type".printf (get_ccode_lower_case_name (type_symbol, null))));
|
|
register_call.add_argument (new CCodeIdentifier (module_init_param_name));
|
|
ccode.add_expression (register_call);
|
|
|
|
- var iface = type_symbol as Interface;
|
|
- if (iface != null) {
|
|
- string? dbus_name = GDBusModule.get_dbus_name(type_symbol);
|
|
-
|
|
- if (dbus_name != null) {
|
|
- string proxy_cname = get_ccode_lower_case_prefix (type_symbol) + "proxy";
|
|
- var register_proxy = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_dynamic_type".printf (proxy_cname)));
|
|
- register_proxy.add_argument (new CCodeIdentifier (module_init_param_name));
|
|
- ccode.add_expression (register_proxy);
|
|
- }
|
|
+ if (is_dbus_interface) {
|
|
+ string proxy_cname = get_ccode_lower_case_prefix (type_symbol) + "proxy";
|
|
+ var register_proxy = new CCodeFunctionCall (new CCodeIdentifier ("%s_register_dynamic_type".printf (proxy_cname)));
|
|
+ register_proxy.add_argument (new CCodeIdentifier (module_init_param_name));
|
|
+ ccode.add_expression (register_proxy);
|
|
}
|
|
}
|
|
|