summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-internals.h
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-17 23:46:21 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-17 23:46:21 +0000
commit615fa679e1f8339d4f57e8b6dc49e7fb5da49f2d (patch)
tree83e861f5343463dec864153d8e90ddcc157f1eaa /dbus/dbus-internals.h
parent1fbf6fa49c90010f3f255f60944920ef8908701c (diff)
2003-03-17 Havoc Pennington <hp@redhat.com>
* dbus/dbus-internals.h: add gcc attributes so that our printf-style functions warn on bad arguments to format * dbus/dbus-sysdeps.c (_dbus_connect_tcp_socket): fix printf format bug * dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix printf format bug
Diffstat (limited to 'dbus/dbus-internals.h')
-rw-r--r--dbus/dbus-internals.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h
index 559b38ec..e77c174c 100644
--- a/dbus/dbus-internals.h
+++ b/dbus/dbus-internals.h
@@ -37,10 +37,26 @@
DBUS_BEGIN_DECLS;
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#define _DBUS_GNUC_SCANF( format_idx, arg_idx ) \
+ __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
+#define _DBUS_GNUC_FORMAT( arg_idx ) \
+ __attribute__((__format_arg__ (arg_idx)))
+#define _DBUS_GNUC_NORETURN \
+ __attribute__((__noreturn__))
+#else /* !__GNUC__ */
+#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
+#define _DBUS_GNUC_SCANF( format_idx, arg_idx )
+#define _DBUS_GNUC_FORMAT( arg_idx )
+#define _DBUS_GNUC_NORETURN
+#endif /* !__GNUC__ */
+
void _dbus_warn (const char *format,
- ...);
+ ...) _DBUS_GNUC_PRINTF (1, 2);
void _dbus_verbose_real (const char *format,
- ...);
+ ...) _DBUS_GNUC_PRINTF (1, 2);
#ifdef DBUS_ENABLE_VERBOSE_MODE