[vala/wip/ricotz: 2/2] codegen: Append G_GNUC_FORMAT attribute to FormatArg function-declarations
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/ricotz: 2/2] codegen: Append G_GNUC_FORMAT attribute to FormatArg function-declarations
- Date: Mon, 7 Nov 2016 18:04:18 +0000 (UTC)
commit 2fb6a88d413ed0f81b309fa05ee82bffdcf602da
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Nov 7 18:57:15 2016 +0100
codegen: Append G_GNUC_FORMAT attribute to FormatArg function-declarations
codegen/valaccodemethodmodule.vala | 6 ++++++
vala/valamemberaccess.vala | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 19f507b..e39e321 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -173,6 +173,12 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
function.modifiers |= CCodeModifiers.DEPRECATED;
}
+ var format_arg = m.get_format_arg_index ();
+ if (format_arg > -1) {
+ format_arg += (MemberAccess.is_instance_symbol (m) ? 2 : 1);
+ function.attributes = "G_GNUC_FORMAT(%d)".printf (format_arg);
+ }
+
var cparam_map = new HashMap<int,CCodeParameter> (direct_hash, direct_equal);
var carg_map = new HashMap<int,CCodeExpression> (direct_hash, direct_equal);
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 6911bef..f46a713 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -866,7 +866,7 @@ public class Vala.MemberAccess : Expression {
return !error;
}
- static bool is_instance_symbol (Symbol symbol) {
+ public static bool is_instance_symbol (Symbol symbol) {
if (symbol is Field && ((Field) symbol).binding == MemberBinding.INSTANCE) {
return true;
} else if (symbol is Method && !(symbol is CreationMethod) && ((Method) symbol).binding ==
MemberBinding.INSTANCE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]