diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-04-14 11:05:44 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2015-04-14 11:05:44 +0100 |
commit | 3ad560815ae9f143a0851b43454e66d26f18888d (patch) | |
tree | 4a231835ea5c415fc14b0964277398be387a6bc6 /stun | |
parent | 4e4af4be3890f12e300fe71104564171091b7a17 (diff) | |
download | libnice-3ad560815ae9f143a0851b43454e66d26f18888d.tar.gz |
stun: Add missing format attributes for va_list printf functions
As detected by GCC 4.9.
Diffstat (limited to 'stun')
-rw-r--r-- | stun/debug.c | 9 | ||||
-rw-r--r-- | stun/debug.h | 5 |
2 files changed, 14 insertions, 0 deletions
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: |