mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gmacros.h: Complete the use of GLIB_AVAILABLE_MACRO_IN_*
This adds `GLIB_AVAILABLE_MACRO_IN_*` where needed, or a comment when such use is not possible. Fixes #2376.
This commit is contained in:
parent
afceb250ce
commit
f20bcf2969
@ -188,6 +188,11 @@
|
||||
*
|
||||
* Since: 2.58
|
||||
*/
|
||||
/* Note: We can’t annotate this with GLIB_AVAILABLE_MACRO_IN_2_58 because it’s
|
||||
* used within the GLib headers in function declarations which are always
|
||||
* evaluated when a header is included. This results in warnings in third party
|
||||
* code which includes glib.h, even if the third party code doesn’t use the new
|
||||
* macro itself. */
|
||||
|
||||
#if G_GNUC_CHECK_VERSION(2, 96)
|
||||
#define G_GNUC_PURE __attribute__((__pure__))
|
||||
@ -517,14 +522,16 @@
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (gnu_scanf, format_idx, arg_idx)))
|
||||
#define G_GNUC_STRFTIME( format_idx ) \
|
||||
__attribute__((__format__ (gnu_strftime, format_idx, 0)))
|
||||
__attribute__((__format__ (gnu_strftime, format_idx, 0))) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#else
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__scanf__, format_idx, arg_idx)))
|
||||
#define G_GNUC_STRFTIME( format_idx ) \
|
||||
__attribute__((__format__ (__strftime__, format_idx, 0)))
|
||||
__attribute__((__format__ (__strftime__, format_idx, 0))) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#endif
|
||||
#define G_GNUC_FORMAT( arg_idx ) \
|
||||
__attribute__((__format_arg__ (arg_idx)))
|
||||
@ -539,7 +546,8 @@
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx )
|
||||
#define G_GNUC_STRFTIME( format_idx )
|
||||
#define G_GNUC_STRFTIME( format_idx ) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#define G_GNUC_FORMAT( arg_idx )
|
||||
/* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__,
|
||||
* __declspec can only be placed at the start of the function prototype
|
||||
@ -580,11 +588,14 @@
|
||||
* Since: 2.60
|
||||
*/
|
||||
#if G_GNUC_CHECK_VERSION(6, 0)
|
||||
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
|
||||
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#elif g_macro__has_attribute (fallthrough)
|
||||
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
|
||||
#define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#else
|
||||
#define G_GNUC_FALLTHROUGH
|
||||
#define G_GNUC_FALLTHROUGH \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/**
|
||||
@ -636,9 +647,11 @@
|
||||
*/
|
||||
#if G_GNUC_CHECK_VERSION(4, 5) || defined(__clang__)
|
||||
#define G_GNUC_DEPRECATED_FOR(f) \
|
||||
__attribute__((deprecated("Use " #f " instead")))
|
||||
__attribute__((deprecated("Use " #f " instead"))) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_26
|
||||
#else
|
||||
#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
|
||||
#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_26
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __ICC
|
||||
@ -912,9 +925,11 @@
|
||||
* Since: 2.60
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
|
||||
#define G_ALIGNOF(type) _Alignof (type)
|
||||
#define G_ALIGNOF(type) _Alignof (type) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#else
|
||||
#define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b))
|
||||
#define G_ALIGNOF(type) (G_STRUCT_OFFSET (struct { char a; type b; }, b)) \
|
||||
GLIB_AVAILABLE_MACRO_IN_2_60
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user