summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2023-02-07 11:39:29 +0000
committerSimon McVittie <smcv@debian.org>2023-02-07 11:54:33 +0000
commitc142812f7653cd1f6e52224da8410cd09f102a4f (patch)
treee31ae092f7e6304fe0309f1202d97a24cfd828c9
parenta1a330b8720e4bc1c2154f120196372627dc7b2a (diff)
downloadaccountsservice-c142812f7653cd1f6e52224da8410cd09f102a4f.tar.gz
Annotate varargs functions with G_GNUC_PRINTF
This lets the compiler detect and diagnose type mismatches like the one fixed in the previous commit. Helps: https://gitlab.freedesktop.org/accountsservice/accountsservice/-/issues/109 Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r--src/daemon.c5
-rw-r--r--src/user.c5
-rw-r--r--src/util.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/src/daemon.c b/src/daemon.c
index 81bf5ad..0fbd1d7 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -876,6 +876,11 @@ daemon_new (void)
return g_steal_pointer (&daemon);
}
+static void throw_error (GDBusMethodInvocation *context,
+ gint error_code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
static void
throw_error (GDBusMethodInvocation *context,
gint error_code,
diff --git a/src/user.c b/src/user.c
index 67cbb1b..0a8e586 100644
--- a/src/user.c
+++ b/src/user.c
@@ -1120,6 +1120,11 @@ user_set_saved (User *user,
accounts_user_set_saved (ACCOUNTS_USER (user), saved);
}
+static void throw_error (GDBusMethodInvocation *context,
+ gint error_code,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (3, 4);
+
static void
throw_error (GDBusMethodInvocation *context,
gint error_code,
diff --git a/src/util.h b/src/util.h
index d2cd6ed..c8a4a2d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -25,7 +25,7 @@
void sys_log (GDBusMethodInvocation *context,
const gchar *format,
- ...);
+ ...) G_GNUC_PRINTF (2, 3);
gboolean get_caller_uid (GDBusMethodInvocation *context,
gint *uid);