From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3183C433EF for ; Wed, 8 Sep 2021 13:52:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B7E06109F for ; Wed, 8 Sep 2021 13:52:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B7E06109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:39870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNy0H-00014N-Lg for qemu-devel@archiver.kernel.org; Wed, 08 Sep 2021 09:52:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNxxF-0006v9-2U for qemu-devel@nongnu.org; Wed, 08 Sep 2021 09:49:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNxxD-0005zV-Cv for qemu-devel@nongnu.org; Wed, 08 Sep 2021 09:49:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631108970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9xfmtNEMyrdcimaJb2bZVEbqyqTiGAsQJ7oBnzPJGmc=; b=eaqUWCpmVS66B59vfUbiiksdJjUsXJsB/EaPu/Yn/DvzeVy9LYF2R1w6RdMMw2JXVVo3o+ 6h509NqJKH7bMNwtJUDblMOAms3acsuHfyQ15j/8G4wpIGp6gRYFEqqxm6MhWT1rIqNH5N RhoVBPWtm3IBdm6xROdzpNNAFLWgQaU= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-INhMoGlWNtyPu14n2du6Rw-1; Wed, 08 Sep 2021 09:49:28 -0400 X-MC-Unique: INhMoGlWNtyPu14n2du6Rw-1 Received: by mail-pf1-f200.google.com with SMTP id a24-20020a62e218000000b003fdd5bdf6baso1450352pfi.1 for ; Wed, 08 Sep 2021 06:49:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9xfmtNEMyrdcimaJb2bZVEbqyqTiGAsQJ7oBnzPJGmc=; b=ClCdNuRTCYXRFA7J+c1PX7pvprOmExnxnfQdOW9mjj9jk9tXMLpeRcTv+SZ10vMzK7 iRiP4Cmz4LEs0kqkHuR9vkJyZCEWpx6YEnSy81V6wlwffsaMj7syExZqT0mcOV7RbZi9 YDl+0plByCLrR4L0MgzJSZsJisxYhNB34vwnfpGeqG+Dnv+d2KdrgXuEZkagJh0Qojkz 1FIAUu93zcBtyg3QaO5u4p8YMouogu0B82Ca3V+bz9cwYP9KQNxSozVYdg2J9taKTAUC /QYhWjS1H19bbF5WiyHpuOz739+coYt0v1cpaRSNs2QccccCIhZGZ2M5e4/syshSzAxs Owrw== X-Gm-Message-State: AOAM5303jNZJ0qo4NvEAzDh/P/ODmyT+8OUZD9F4j86Yy2B/k2Vub1LV dyNmyb+uGCeiFl45ivUZnCFzimrpaIQdZ2Yt8h6wHPv4j+5c2dViC3irWeyRaa6qvHksWS03Og5 cOu2c39PcGFdF7I+0f94K1N4m5Ek2/Tw= X-Received: by 2002:a17:90a:6f01:: with SMTP id d1mr4319606pjk.36.1631108967832; Wed, 08 Sep 2021 06:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB8VmsXmuvMKjBL/goftDYPy+dJNRvOddcAxSxEo6jzkzPeDmYI9+3i4oasF76s5F4U6M4r4P2tNiYJqjXpFw= X-Received: by 2002:a17:90a:6f01:: with SMTP id d1mr4319576pjk.36.1631108967506; Wed, 08 Sep 2021 06:49:27 -0700 (PDT) MIME-Version: 1.0 References: <20210907121943.3498701-1-marcandre.lureau@redhat.com> <20210907121943.3498701-5-marcandre.lureau@redhat.com> <87r1dzw9cc.fsf@dusky.pond.sub.org> In-Reply-To: <87r1dzw9cc.fsf@dusky.pond.sub.org> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Wed, 8 Sep 2021 17:49:16 +0400 Message-ID: Subject: Re: [RFC v3 04/32] glib-compat: add G_SIZEOF_MEMBER To: Markus Armbruster Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000993d9b05cb7c267d" Received-SPF: pass client-ip=216.205.24.124; envelope-from=mlureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Bonzini, Paolo" , "P. Berrange, Daniel" , qemu-devel , Stefan Hajnoczi Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000993d9b05cb7c267d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Wed, Sep 8, 2021 at 4:16 PM Markus Armbruster wrote: > marcandre.lureau@redhat.com writes: > > > From: Marc-Andr=C3=A9 Lureau > > > > 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=C3=A9 Lureau > > --- > > 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 >=3D 2.64. --000000000000993d9b05cb7c267d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Sep 8, 2021 at 4:16 PM Mark= us Armbruster <armbru@redhat.com> wrote:
marcandre.lur= eau@redhat.com writes:

> From: Marc-Andr=C3=A9 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=C3=A9 Lureau <marcandre.lureau@redhat.com> > ---
>=C2=A0 include/glib-compat.h | 7 +++++++
>=C2=A0 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)
>=C2=A0
>=C2=A0 #pragma GCC diagnostic pop
>=C2=A0
> +/* introduced in 2.64 */
> +#ifdef G_SIZEOF_MEMBER
> +#undef G_SIZEOF_MEMBER
> +#endif
> +
> +#define G_SIZEOF_MEMBER(type, member) sizeof(((type *)0)->member)<= br> > +
>=C2=A0 #endif

What's wrong with

=C2=A0 =C2=A0#if !GLIB_VERSION(2, 64, 0)
=C2=A0 =C2=A0#define G_SIZEOF_MEMBER(type, member) sizeof(((type *)0)->m= ember)
=C2=A0 =C2=A0#endif


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

--000000000000993d9b05cb7c267d--