From nobody Tue Apr 23 23:38:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605558703; cv=none; d=zohomail.com; s=zohoarc; b=eFelKnv0XBDnfmDOuqxd46DlJCaYLtz9q44cLa+VsdaC5UhmNueN8WBbMLnGb7KB9/tpD0If/84zfmlx+VA8tyZTlKjBbQfWxgMZ49/Xqz22m1UkSdTLTvHX53rn6RpImbJioT7l+kAIjLK3Q2WPR9/BMzb+af9bttmm0JGp6mk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605558703; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=4Eb2Gz/AtjgET6jfoijjHSc4vTwQngMba4XUAEp3hKg=; b=FwOudZcMgg20nRYPB1+FN1Dn37LwWgMsUPOwryCpQwqUSyF0U6J1LLRPioYE+EPfIAIQet99VuiRY1HnV0ln2B2O8RWTBAW5LVIaY6MQ2zft3NK/XXdRrSg0feuSo3lRhOeJvBoLJ7G85ScId813f6ElES59c9vcpxrS4DSkgmw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605558703717250.43857933406252; Mon, 16 Nov 2020 12:31:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-HBPAvQmGOHek2XBgaw21eA-1; Mon, 16 Nov 2020 15:31:40 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 664461084C85; Mon, 16 Nov 2020 20:31:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80802610AF; Mon, 16 Nov 2020 20:31:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C6DB5811E; Mon, 16 Nov 2020 20:31:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AGKVRg9025250 for ; Mon, 16 Nov 2020 15:31:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 03EC05C221; Mon, 16 Nov 2020 20:31:27 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85E675C1DA; Mon, 16 Nov 2020 20:31:23 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 391BFC2075E; Mon, 16 Nov 2020 21:31:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605558702; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4Eb2Gz/AtjgET6jfoijjHSc4vTwQngMba4XUAEp3hKg=; b=QTMwdBSu9yYJyrgj7MM6+2oM0a6uQhl/dQpOdZXo0QG37wqI9+fIgoYDmQyADoY2inueg5 JFm3HeaSUQTPXzLUfTRVtQKLHS+ae5thNZpEsjeyeMXeGP7HtoAL6rNtW5vsQbFYn6vdbN 6UpFwnOF4l4au2mKMxak9cgOykG66ns= X-MC-Unique: HBPAvQmGOHek2XBgaw21eA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH v3] Do not disable incompatible-pointer-types-discards-qualifiers Date: Mon, 16 Nov 2020 21:31:22 +0100 Message-Id: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This reverts commit b3710e9a2af402a2b620de570b062294e11190eb. That check is very valuable for our code, but it causes issue with glib >= =3D 2.67.0 when building with clang. The reason is a combination of two commits in glib, firstly fdda405b6b1b wh= ich adds a g_atomic_pointer_{set,get} variants that enforce stricter type checking (by removing an extra cast) for compilers that support __typeof__,= and commit dce24dc4492d which effectively enabled the new variant of glib's ato= mic code for clang. This will not be necessary when glib's issue #600 [0] (8 y= ears old) is fixed. Thankfully, MR #1719 [1], which is supposed to deal with th= is issue was opened 3 weeks ago, so there is a slight sliver of hope. [0] https://gitlab.gnome.org/GNOME/glib/-/issues/600 [1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Signed-off-by: Martin Kletzander Reviewed-by: Daniel P. Berrang=C3=A9 --- v3: - added check for glib version v2: - override _G_DEFINE_TYPE_EXTENDED_BEGIN in gcompat.h meson.build | 3 --- src/util/glibcompat.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index cecaad199d4c..04646e3a078c 100644 --- a/meson.build +++ b/meson.build @@ -405,9 +405,6 @@ cc_flags +=3D [ # so use this Clang-specific arg to keep it quiet '-Wno-typedef-redefinition', =20 - # Clang complains about casts in G_DEFINE_TYPE(...) - '-Wno-incompatible-pointer-types-discards-qualifiers', - # We don't use -Wc++-compat so we have to enable it explicitly '-Wjump-misses-init', =20 diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h index 6f50a76f3c2b..457f6ba797f3 100644 --- a/src/util/glibcompat.h +++ b/src/util/glibcompat.h @@ -20,6 +20,30 @@ =20 #include #include +#include + +#if defined(__clang__) && GLIB_CHECK_VERSION(2, 67, 0) +/* + * Clang detects (valid) issue in G_DEFINE_TYPE and derivatives starting w= ith + * glib >=3D 2.67.0. See https://gitlab.gnome.org/GNOME/glib/-/issues/600 + * + * For that we need to disable the one check that produces an error in our + * builds when using any G_DEFINE_TYPE* macro. Thankfully all those macro= s end + * up using _G_DEFINE_TYPE_EXTENDED_BEGIN. Because with that we can redef= ine + * this one macro to cover all use cases. The macro is defined the same w= ay it + * is defined in glib (with a very low probability of being changed thanks= to a + * comment above it). + */ +# undef _G_DEFINE_TYPE_EXTENDED_BEGIN + +# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, f= lags) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types-discard= s-qualifiers\"") \ + _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ + _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER(TypeName, type_name, TYPE_PAREN= T, flags) \ + _Pragma("GCC diagnostic pop") + +#endif /* __clang__ */ =20 gchar * vir_g_canonicalize_filename(const gchar *filename, const gchar *relative_to); --=20 2.29.2