mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
Add better deprecation macros
Unlike G_GNUC_... macros, the new G_DEPRECATED[_FOR] are meant as abstractions that work with different compilers. Using a new name also lets us restrict it to 'must be placed before the declaration', which works with more compilers. https://bugzilla.gnome.org/show_bug.cgi?id=661438
This commit is contained in:
parent
a73113908f
commit
0da0411a4a
@ -362,6 +362,10 @@ G_HAVE_GNUC_VISIBILITY
|
|||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
G_GNUC_MAY_ALIAS
|
G_GNUC_MAY_ALIAS
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
G_DEPRECATED
|
||||||
|
G_DEPRECATED_FOR
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
G_LIKELY
|
G_LIKELY
|
||||||
G_UNLIKELY
|
G_UNLIKELY
|
||||||
|
@ -287,4 +287,21 @@
|
|||||||
#define G_UNLIKELY(expr) (expr)
|
#define G_UNLIKELY(expr) (expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
#define G_DEPRECATED __attribute__((__deprecated__))
|
||||||
|
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||||
|
#define G_GNUC_DEPRECATED __declspec(deprecated)
|
||||||
|
#else
|
||||||
|
#define G_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||||
|
#define G_DEPRECATED_FOR(f) __attribute__((deprecated("Use '" #f "' instead")))
|
||||||
|
#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
|
||||||
|
#define G_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
|
||||||
|
#else
|
||||||
|
#define G_DEPRECATED_FOR(f) G_DEPRECATED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* __G_MACROS_H__ */
|
#endif /* __G_MACROS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user