[Spice-devel] [PATCH spice-gtk] G_GNUC_DEPRECATED_FOR must be defined publicly

Christophe Fergeau cfergeau at redhat.com
Mon Sep 10 01:27:05 PDT 2012


On Fri, Sep 07, 2012 at 04:59:31PM +0200, Marc-André Lureau wrote:
> It's not enough to define G_GNUC_DEPRECATED_FOR in glib-compat.h,
> since this header is not public. Instead, let's define our own
> public SPICE_DEPRECATED_FOR macro, and clean-up double definition.
> ---
>  gtk/glib-compat.h | 16 ----------------
>  gtk/spice-util.h  | 12 +++++++++++-
>  2 files changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h
> index a9efda3..909b4e1 100644
> --- a/gtk/glib-compat.h
> +++ b/gtk/glib-compat.h
> @@ -67,13 +67,6 @@ type_name##_get_type (void) \
>  #define G_TYPE_ERROR (spice_error_get_type ())
>  GType spice_error_get_type (void) G_GNUC_CONST;
>  
> -#if    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
> -#define G_GNUC_DEPRECATED_FOR(f)                        \
> -  __attribute__((deprecated("Use " #f " instead")))
> -#else
> -#define G_GNUC_DEPRECATED_FOR(f)        G_GNUC_DEPRECATED
> -#endif /* __GNUC__ */
> -
>  #define G_PARAM_DEPRECATED  (1 << 31)
>  #endif /* glib 2.26 */
>  
> @@ -126,13 +119,4 @@ GType spice_main_context_get_type (void) G_GNUC_CONST;
>    } G_STMT_END
>  #endif
>  
> -#ifndef G_GNUC_DEPRECATED_FOR
> -#if    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
> -#define G_GNUC_DEPRECATED_FOR(f)                        \
> -  __attribute__((deprecated("Use " #f " instead")))
> -#else
> -#define G_GNUC_DEPRECATED_FOR(f)        G_GNUC_DEPRECATED
> -#endif /* __GNUC__ */
> -#endif
> -
>  #endif /* GLIB_COMPAT_H */
> diff --git a/gtk/spice-util.h b/gtk/spice-util.h
> index 271f3be..6996e55 100644
> --- a/gtk/spice-util.h
> +++ b/gtk/spice-util.h
> @@ -39,8 +39,18 @@ gulong spice_g_signal_connect_object(gpointer instance,
>  
>  #define SPICE_RESERVED_PADDING (10 * sizeof(void*))
>  
> +/* need to be in a public header, glib-compat.h is private */
> +#ifndef SPICE_GNUC_DEPRECATED_FOR
> +#if    __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)        G_GNUC_DEPRECATED
> +#endif /* __GNUC__ */
> +#endif
> +

Looks good, ACK, just wondering if we should try to reuse
G_GNUC_DEPRECATED_FOR as much as possible, something like:
#ifndef SPICE_GNUC_DEPRECATED_FOR
 #ifdef G_GNUC_DEPRECATED_FOR
  #define SPICE_GNUC_DEPRECATED_FOR G_GNUC_DEPRECATED_FOR
 #else
  #if    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
   #define SPICE_GNUC_DEPRECATED_FOR(f)                        \
     __attribute__((deprecated("Use " #f " instead")))
...

I'm fine with the patch as it is now.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120910/ddf47041/attachment.pgp>


More information about the Spice-devel mailing list