> 
> 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().
> 

I'm not really sure it's a good idea to disable deprecation
warnings. If a program does want to ignore warnings I will
just force to avoid -Werror and tolerate the warnings.

> Signed-off-by: Francois Gouget <fgou...@codeweavers.com>
> ---
>  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))

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to