diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2016-11-07 21:03:56 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2016-11-07 21:27:36 +0100 |
commit | d2175507afe8ec774676a90eb652612816c6d694 (patch) | |
tree | 4c0bd9f85f7c7a8a55ccb3a20c93ef8545fc1ada /ccode | |
parent | f2abdf6c72e083c78e5a2008e381ec76f27aad97 (diff) | |
download | vala-d2175507afe8ec774676a90eb652612816c6d694.tar.gz |
codegen: Add G_GNUC_FORMAT attribute for FormatArg function-pointers
Diffstat (limited to 'ccode')
-rw-r--r-- | ccode/valaccodefunctiondeclarator.vala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ccode/valaccodefunctiondeclarator.vala b/ccode/valaccodefunctiondeclarator.vala index fc59aa830..08aea1dbc 100644 --- a/ccode/valaccodefunctiondeclarator.vala +++ b/ccode/valaccodefunctiondeclarator.vala @@ -55,16 +55,23 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator { writer.write_string (name); writer.write_string (") ("); - bool first = true; + int i = 0; + int format_arg_index = -1; foreach (CCodeParameter param in parameters) { - if (!first) { + if (i > 0) { writer.write_string (", "); - } else { - first = false; } param.write (writer); + if (param.format_arg) { + format_arg_index = i; + } + i++; } writer.write_string (")"); + + if (format_arg_index >= 0) { + writer.write_string (" G_GNUC_FORMAT(%d)".printf (format_arg_index + 1)); + } } } |