diff --git a/0001-codegen-Add-function-prototypes-for-all-register-typ.patch b/0001-codegen-Add-function-prototypes-for-all-register-typ.patch new file mode 100644 index 0000000..abd019d --- /dev/null +++ b/0001-codegen-Add-function-prototypes-for-all-register-typ.patch @@ -0,0 +1,60 @@ +From b3e178b00ea77e2734f81262263e4ea1aab1e362 Mon Sep 17 00:00:00 2001 +From: Rico Tzschichholz +Date: Thu, 1 Dec 2016 18:09:48 +0100 +Subject: [PATCH] codegen: Add function-prototypes for all register-type calls + +Make sure to match the list of called register-type calls and include +implemented classes and interfaces. + +https://bugzilla.gnome.org/show_bug.cgi?id=775446 +--- + codegen/valaccodemethodmodule.vala | 6 ++++++ + codegen/valatyperegisterfunction.vala | 8 ++++---- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala +index fc5ffc7..0f051f5 100644 +--- a/codegen/valaccodemethodmodule.vala ++++ b/codegen/valaccodemethodmodule.vala +@@ -267,6 +267,12 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule { + } + } + ++ // Add function prototypes for required register-type-calls which are likely external ++ var register_func = new CCodeFunction ("%s_register_type".printf (get_ccode_lower_case_name (type_symbol, null)), "GType"); ++ register_func.add_parameter (new CCodeParameter ("module", "GTypeModule *")); ++ register_func.is_declaration = true; ++ cfile.add_function_declaration (register_func); ++ + 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); +diff --git a/codegen/valatyperegisterfunction.vala b/codegen/valatyperegisterfunction.vala +index b7c18f8..79ae1b3 100644 +--- a/codegen/valatyperegisterfunction.vala ++++ b/codegen/valatyperegisterfunction.vala +@@ -80,6 +80,10 @@ public abstract class Vala.TypeRegisterFunction { + // avoid C warning as this function is not always used + fun.attributes += " G_GNUC_UNUSED"; + } ++ ++ fun.is_declaration = true; ++ declaration_fragment.append (fun.copy ()); ++ fun.is_declaration = false; + } else { + fun = new CCodeFunction ("%s_register_type".printf (CCodeBaseModule.get_ccode_lower_case_name (get_type_declaration ())), "GType"); + fun.add_parameter (new CCodeParameter ("module", "GTypeModule *")); +@@ -252,10 +256,6 @@ public abstract class Vala.TypeRegisterFunction { + type_block.add_statement (new CCodeReturnStatement (new CCodeIdentifier (type_id_name))); + } + +- fun.is_declaration = true; +- declaration_fragment.append (fun.copy ()); +- fun.is_declaration = false; +- + fun.block = type_block; + + definition_fragment.append (fun); +-- +2.9.3 + diff --git a/vala.spec b/vala.spec index 5e65616..57ba74c 100644 --- a/vala.spec +++ b/vala.spec @@ -3,13 +3,15 @@ Name: vala Version: 0.34.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A modern programming language for GNOME # Most files are LGPLv2.1+, curses.vapi is 2-clause BSD License: LGPLv2+ and BSD URL: https://wiki.gnome.org/Projects/Vala Source0: https://download.gnome.org/sources/vala/0.34/vala-%{version}.tar.xz +# https://bugzilla.gnome.org/show_bug.cgi?id=775446 +Patch0: 0001-codegen-Add-function-prototypes-for-all-register-typ.patch BuildRequires: flex BuildRequires: bison @@ -86,6 +88,7 @@ This package contains documentation in a devhelp HTML book. %prep %setup -q +%patch0 -p1 %build @@ -181,6 +184,9 @@ done %changelog +* Thu Dec 01 2016 Kalev Lember - 0.34.3-2 +- codegen: Add function-prototypes for all register-type calls + * Tue Nov 22 2016 Kalev Lember - 0.34.3-1 - Update to 0.34.3