Re: [protocol] macros: Mark unused SPICE_GNUC_XXX macros as deprecated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> We don't want to maintain more macros than necessary and in the end
> the equivalent G_GNUC_XXX macros should be preferred.

spice-protocol public header are plain C so suggesting to use Glib is
not correct.

> Should any project actually depend on these macros they can keep using
> them by defining the usual SPICE_DEPRECATED macro until they migrate
> away from them or the macros are reinstated.
> 
> Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
> ---
> 
> I noticed that this patch fell off despite what looked like general
> agreement. I re-grepped for these macros and did not find them used in
> the current Spice codebase which means they have not been used for at
> least two years.
> 

Then maybe the right approach should be remove them.

> https://lists.freedesktop.org/archives/spice-devel/2016-December/034578.html
> 
>  spice/macros.h | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/spice/macros.h b/spice/macros.h
> index ab1d056..95c12d4 100644
> --- a/spice/macros.h
> +++ b/spice/macros.h
> @@ -33,8 +33,14 @@
>  
>  #include <spice/types.h>
>  
> +#ifndef SPICE_DEPRECATED
> +#define SPICE_ATTRIBUTE_DEPRECATED(attribute, name)
> __attribute__((attribute, warning("deprecated, use -DSPICE_DEPRECATED or "
> name " instead")))
> +#else
> +#define SPICE_ATTRIBUTE_DEPRECATED(attribute, name)
> __attribute__((attribute))
> +#endif
> +
>  #if    __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
> -#define SPICE_GNUC_PURE __attribute__((__pure__))
> +#define SPICE_GNUC_PURE SPICE_ATTRIBUTE_DEPRECATED(__pure__, "G_GNUC_PURE")
>  #define SPICE_GNUC_MALLOC __attribute__((__malloc__))
>  #else
>  #define SPICE_GNUC_PURE
> @@ -42,7 +48,7 @@
>  #endif
>  
>  #if     __GNUC__ >= 4
> -#define SPICE_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
> +#define SPICE_GNUC_NULL_TERMINATED SPICE_ATTRIBUTE_DEPRECATED(__sentinel__,
> "G_GNUC_NULL_TERMINATED")
>  #else
>  #define SPICE_GNUC_NULL_TERMINATED
>  #endif
> @@ -62,12 +68,12 @@
>  
>  #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
>  #define SPICE_GNUC_PRINTF( format_idx, arg_idx ) __attribute__((__format__
>  (__printf__, format_idx, arg_idx)))
> -#define SPICE_GNUC_SCANF( format_idx, arg_idx ) __attribute__((__format__
> (__scanf__, format_idx, arg_idx)))
> -#define SPICE_GNUC_FORMAT( arg_idx ) __attribute__((__format_arg__
> (arg_idx)))
> +#define SPICE_GNUC_SCANF( format_idx, arg_idx )
> SPICE_ATTRIBUTE_DEPRECATED(__format__ (__scanf__, format_idx, arg_idx),
> "G_GNUC_SCANF")
> +#define SPICE_GNUC_FORMAT( arg_idx )
> SPICE_ATTRIBUTE_DEPRECATED(__format_arg__ (arg_idx), "G_GNUC_FORMAT")
>  #define SPICE_GNUC_NORETURN __attribute__((__noreturn__))
> -#define SPICE_GNUC_CONST __attribute__((__const__))
> +#define SPICE_GNUC_CONST SPICE_ATTRIBUTE_DEPRECATED(__const__,
> "G_GNUC_CONST")
>  #define SPICE_GNUC_UNUSED __attribute__((__unused__))
> -#define SPICE_GNUC_NO_INSTRUMENT __attribute__((__no_instrument_function__))
> +#define SPICE_GNUC_NO_INSTRUMENT
> SPICE_ATTRIBUTE_DEPRECATED(__no_instrument_function__,
> "G_GNUC_NO_INSTRUMENT")
>  #else   /* !__GNUC__ */
>  #define SPICE_GNUC_PRINTF( format_idx, arg_idx )
>  #define SPICE_GNUC_SCANF( format_idx, arg_idx )

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




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]