Add _DBUS_GNUC_UNUSED, and use it in _DBUS_STATIC_ASSERT
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 9 Sep 2014 11:49:44 +0000 (12:49 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 15 Sep 2014 11:31:04 +0000 (12:31 +0100)
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)

dbus/dbus-internals.h
dbus/dbus-macros.h

index c64d7566d74fbdf1e4cf1a97be1e4e0e4ad084cd..4658b67b668370055e7cb77c3b0378b52a1dbd9a 100644 (file)
@@ -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
 
index cae4100e469f7dea3bb4b7830db3f37575ac365f..8d6c3000acbdb7d563eb8708dd2c5603353447a2 100644 (file)
   __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)