summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-09 12:49:44 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-15 12:31:04 +0100
commitf70c0e98c5cc6eaae4727d14c389e2504e79e694 (patch)
treedb6eaf6a5e2b01a4158b7b0e2167af51684a3be1
parente0c9d31be3b9eea9ee2a3a255bc2cf9aad713642 (diff)
downloaddbus-f70c0e98c5cc6eaae4727d14c389e2504e79e694.tar.gz
Add _DBUS_GNUC_UNUSED, and use it in _DBUS_STATIC_ASSERT
This means we can use _DBUS_STATIC_ASSERT at non-global scope without tripping -Wunused-local-typedefs. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83767 Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> (cherry picked from commit 0e3d08d45cb9a9ceb2c077875eeb38306dad37b8)
-rw-r--r--dbus/dbus-internals.h2
-rw-r--r--dbus/dbus-macros.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h
index c64d7566..4658b67b 100644
--- a/dbus/dbus-internals.h
+++ b/dbus/dbus-internals.h
@@ -371,7 +371,7 @@ dbus_bool_t _dbus_get_local_machine_uuid_encoded (DBusString *uuid_str);
#define _DBUS_PASTE(a, b) _DBUS_PASTE2 (a, b)
#define _DBUS_STATIC_ASSERT(expr) \
typedef struct { char _assertion[(expr) ? 1 : -1]; } \
- _DBUS_PASTE (_DBUS_STATIC_ASSERT_, __LINE__)
+ _DBUS_PASTE (_DBUS_STATIC_ASSERT_, __LINE__) _DBUS_GNUC_UNUSED
DBUS_END_DECLS
diff --git a/dbus/dbus-macros.h b/dbus/dbus-macros.h
index cae4100e..8d6c3000 100644
--- a/dbus/dbus-macros.h
+++ b/dbus/dbus-macros.h
@@ -69,9 +69,12 @@
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
#define _DBUS_GNUC_NORETURN \
__attribute__((__noreturn__))
+#define _DBUS_GNUC_UNUSED \
+ __attribute__((__unused__))
#else /* !__GNUC__ */
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
#define _DBUS_GNUC_NORETURN
+#define _DBUS_GNUC_UNUSED
#endif /* !__GNUC__ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)