mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-17 21:50:31 +01:00
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 0e3d08d45c)
This commit is contained in:
parent
e0c9d31be3
commit
f70c0e98c5
2 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue