qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER


From: Marc-André Lureau
Subject: Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER
Date: Wed, 8 Sep 2021 17:49:16 +0400

Hi

On Wed, Sep 8, 2021 at 4:16 PM Markus Armbruster <armbru@redhat.com> wrote:
marcandre.lureau@redhat.com writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The macro was introduced in 2.64. Let's redefine it, to allow its usage
> with older versions and silence the deprecation warning.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/glib-compat.h | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index 9e95c888f5..e278e09d1d 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -110,4 +110,11 @@ qemu_g_test_slow(void)

>  #pragma GCC diagnostic pop

> +/* introduced in 2.64 */
> +#ifdef G_SIZEOF_MEMBER
> +#undef G_SIZEOF_MEMBER
> +#endif
> +
> +#define G_SIZEOF_MEMBER(type, member) sizeof(((type *)0)->member)
> +
>  #endif

What's wrong with

   #if !GLIB_VERSION(2, 64, 0)
   #define G_SIZEOF_MEMBER(type, member) sizeof(((type *)0)->member)
   #endif


You would get "deprecation" warnings with glib >= 2.64.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]