summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-04-14 11:05:44 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-04-14 11:05:44 +0100
commit3ad560815ae9f143a0851b43454e66d26f18888d (patch)
tree4a231835ea5c415fc14b0964277398be387a6bc6
parent4e4af4be3890f12e300fe71104564171091b7a17 (diff)
downloadlibnice-3ad560815ae9f143a0851b43454e66d26f18888d.tar.gz
stun: Add missing format attributes for va_list printf functions
As detected by GCC 4.9.
-rw-r--r--agent/debug.c3
-rw-r--r--stun/debug.c9
-rw-r--r--stun/debug.h5
3 files changed, 17 insertions, 0 deletions
diff --git a/agent/debug.c b/agent/debug.c
index b4167d8..6e69f9b 100644
--- a/agent/debug.c
+++ b/agent/debug.c
@@ -63,6 +63,9 @@ static const GDebugKey keys[] = {
};
static void
+stun_handler (const char *format, va_list ap) G_GNUC_PRINTF (1, 0);
+
+static void
stun_handler (const char *format, va_list ap)
{
g_logv ("libnice-stun", G_LOG_LEVEL_DEBUG, format, ap);
diff --git a/stun/debug.c b/stun/debug.c
index 3d579db..2b4ec59 100644
--- a/stun/debug.c
+++ b/stun/debug.c
@@ -55,6 +55,15 @@ void stun_debug_disable (void) {
debug_enabled = 0;
}
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define GNUC_PRINTF(format_idx, arg_idx) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#else
+#define GNUC_PRINTF( format_idx, arg_idx)
+#endif
+
+static void
+default_handler (const char *format, va_list ap) GNUC_PRINTF (1, 0);
static void
default_handler (const char *format, va_list ap)
diff --git a/stun/debug.h b/stun/debug.h
index d4884d5..47a6114 100644
--- a/stun/debug.h
+++ b/stun/debug.h
@@ -66,7 +66,12 @@ void stun_debug_disable (void);
*
* Callback for a debug message from the STUN code.
*/
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
+typedef void (*StunDebugHandler) (const char *format, va_list ap)
+ __attribute__((__format__ (__printf__, 1, 0)));
+#else
typedef void (*StunDebugHandler) (const char *format, va_list ap);
+#endif
/**
* stun_set_debug_handler: