If the user specifically requests access to the deprecated APIs by defining the SPICE_DEPRECATED macro, then turn off the SPICE_GNUC_DEPRECATED* warnings. Also automatically use G_GNUC_DEPRECATED if available. Add SPICE_GNUC_DEPRECATED_FOR(). Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx> --- spice/macros.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/spice/macros.h b/spice/macros.h index a0413f3..6e2dbce 100644 --- a/spice/macros.h +++ b/spice/macros.h @@ -78,11 +78,25 @@ #define SPICE_GNUC_NO_INSTRUMENT #endif /* !__GNUC__ */ -#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) -#define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__)) +#if defined(SPICE_DEPRECATED) +/* Don't warn when deprecated APIs have been explicitly asked for */ +# define SPICE_GNUC_DEPRECATED +#elif defined(G_GNUC_DEPRECATED) +# define SPICE_GNUC_DEPRECATED G_GNUC_DEPRECATED +#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +# define SPICE_GNUC_DEPRECATED __attribute__((__deprecated__)) #else -#define SPICE_GNUC_DEPRECATED -#endif /* __GNUC__ */ +# define SPICE_GNUC_DEPRECATED +#endif /* __GNUC__ */ + +#if defined(SPICE_DEPRECATED) +/* Don't warn when deprecated APIs have been explicitly asked for */ +# define SPICE_GNUC_DEPRECATED_FOR(f) +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define SPICE_GNUC_DEPRECATED_FOR(f) __attribute__((deprecated("Use " #f " instead"))) +#else +# define SPICE_GNUC_DEPRECATED_FOR(f) SPICE_GNUC_DEPRECATED +#endif /* __GNUC__ */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) # define SPICE_GNUC_MAY_ALIAS __attribute__((may_alias)) -- 2.8.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel