[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER
From: |
Markus Armbruster |
Subject: |
Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER |
Date: |
Wed, 08 Sep 2021 14:16:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
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
?
- Re: [RFC v3 01/32] RFC: docs: add supported host CPUs section, (continued)
[RFC v3 02/32] build-sys: add HAVE_IPPROTO_MPTCP, marcandre . lureau, 2021/09/07
[RFC v3 03/32] scripts/qapi: teach c_param_type() to return const argument type, marcandre . lureau, 2021/09/07
[RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER, marcandre . lureau, 2021/09/07
- Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER,
Markus Armbruster <=
[RFC v3 05/32] scripts/qapi: add QAPISchemaVisitor.visit_module_end, marcandre . lureau, 2021/09/07
[RFC v3 06/32] scripts/qapi: add a CABI module, marcandre . lureau, 2021/09/07
[RFC v3 07/32] scripts/qapi: generate CABI dump for C types, marcandre . lureau, 2021/09/07
[RFC v3 08/32] tests: build qapi-cabi (C ABI dump), marcandre . lureau, 2021/09/07
[RFC v3 09/32] build-sys: add i686 cpu target, marcandre . lureau, 2021/09/07
[RFC v3 10/32] build-sys: add --with-rust{-target} & basic build infrastructure, marcandre . lureau, 2021/09/07