mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Merge branch 'fix-glib-unavailable-macro' into 'master'
gmacros.h: Complete the use of GLIB_UNAVAILABLE_MACRO Closes #2376 See merge request GNOME/glib!2037
This commit is contained in:
commit
80c2981b62
@ -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
|
||||
|
||||
/**
|
||||
@ -1084,8 +1099,10 @@
|
||||
__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
|
||||
#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
|
||||
#define GLIB_DEPRECATED_MACRO _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol")
|
||||
#define GLIB_DEPRECATED_MACRO_FOR(f) _GLIB_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol, replace with " #f)
|
||||
#define GLIB_UNAVAILABLE_MACRO(maj,min) _GLIB_GNUC_DO_PRAGMA(GCC warning "Not available before " #maj "." #min)
|
||||
#define GLIB_DEPRECATED_MACRO_FOR(f) \
|
||||
_GLIB_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
|
||||
#define GLIB_UNAVAILABLE_MACRO(maj,min) \
|
||||
_GLIB_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Not available before maj.min))
|
||||
#else
|
||||
#define GLIB_DEPRECATED_MACRO
|
||||
#define GLIB_DEPRECATED_MACRO_FOR(f)
|
||||
|
Loading…
Reference in New Issue
Block a user