From: Jürg Billeter Date: Tue, 1 Nov 2016 17:03:17 +0000 (+0100) Subject: codegen: Avoid temporary variables for calls to [FormatArg] methods X-Git-Tag: 0.35.1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b905023ff33eb220f86a5a754a8828d89931517a;p=thirdparty%2Fvala.git codegen: Avoid temporary variables for calls to [FormatArg] methods This prevents bogus C compiler warnings with -Wformat-nonliteral. https://bugzilla.gnome.org/show_bug.cgi?id=769229 --- diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index 2cd12b69f..7786d1bf9 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -787,7 +787,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { } } - if (!return_result_via_out_param) { + if (m != null && m.get_format_arg_index () >= 0) { + set_cvalue (expr, ccall_expr); + } else if (!return_result_via_out_param) { var temp_var = get_temp_variable (result_type, result_type.value_owned); var temp_ref = get_variable_cexpression (temp_var.name); @@ -795,10 +797,11 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { ccode.add_assignment (temp_ref, ccall_expr); set_cvalue (expr, temp_ref); + ((GLibValue) expr.target_value).lvalue = true; } else { set_cvalue (expr, ccall_expr); + ((GLibValue) expr.target_value).lvalue = true; } - ((GLibValue) expr.target_value).lvalue = true; } params_it = params.iterator ();