Add G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS

Add new macros to disable -Wdeprecated-declarations around a piece of
code, using the C99 (and GNU89) _Pragma() operator. Replace the
existing use of #pragma for this in gio, and suppress the warnings in
gvaluearray.c as well.

https://bugzilla.gnome.org/show_bug.cgi?id=669671
This commit is contained in:
Dan Winship
2012-02-10 08:49:17 -05:00
parent ab59739e11
commit ca05902a58
6 changed files with 56 additions and 6 deletions

View File

@@ -114,6 +114,17 @@
#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
#endif /* __GNUC__ */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
#define G_GNUC_END_IGNORE_DEPRECATIONS \
_Pragma ("GCC diagnostic pop")
#else
#define G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#define G_GNUC_END_IGNORE_DEPRECATIONS
#endif
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
# define G_GNUC_MAY_ALIAS __attribute__((may_alias))
#else