From nobody Sat Feb 7 13:54:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1606995448; cv=none; d=zohomail.com; s=zohoarc; b=lFfUh06eGCvq0jOKodC1x+WUH4IXKqLZ7YAsyNPzb+1PKnnV9KfrjcpYGeSEky55GrbxAm2HeFMvsoezzUPiAQ/45fpmCURlX3ferpaIKSIFxCBLp4ZGWPDHLg0uwvSKunx56iSvh7Gf34O/WP+cFuhNRzAzsu6e3gnoLn2QBI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606995448; 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=FhICF6IMJcYmlSIq6OG/W88K6xbeejWDaTZkPBncAhs=; b=TG2skE1hfv0ee+mf5pk0jGOwreAlBG5IGrm04Mh+aGbLEyaP7RXub6K47hO0NrKDu4AsZ0zlZJGOFQd2nEHGMLlg5CY1oYifIh0LrI5n4wBHxMkQVbaU8bD7PJBRcNrPTOxuJsdMuObYkbk0VaN+qrddUgpUOp3JeOGR8f6U/HM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1606995448252390.59171830705543; Thu, 3 Dec 2020 03:37:28 -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-587-UhR5myWpM1-_Bp3AL2W-tw-1; Thu, 03 Dec 2020 06:37:24 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DED3858194; Thu, 3 Dec 2020 11:37:18 +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 95EE210023AF; Thu, 3 Dec 2020 11:37:17 +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 8BBD94BB7B; Thu, 3 Dec 2020 11:37:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B3BbEef029149 for ; Thu, 3 Dec 2020 06:37:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id A3C2160C64; Thu, 3 Dec 2020 11:37:14 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (gx270-2.gsslab.fab.redhat.com [10.33.8.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 131E160C17; Thu, 3 Dec 2020 11:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606995447; 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=FhICF6IMJcYmlSIq6OG/W88K6xbeejWDaTZkPBncAhs=; b=DmV/lnM7KE8COSSZAtJS5sfhWLA42AYTZYJxABSWj1p1xjG5ntSyPb5Ft1Lvk3/JY0q5sK /4UyjPHdroIX4/mRtdroFUK+60zuh+N9UPGdfZ9M4tQi0JEDkAMBJ4TEmt+MXi1Gr/a6II 7QuWeTzao6lA5ENXHyfXSaKN3zvqaxY= X-MC-Unique: UhR5myWpM1-_Bp3AL2W-tw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] util: squelch G_DEFINE_TYPE volatile warnings with GCC 11 Date: Thu, 3 Dec 2020 11:37:10 +0000 Message-Id: <20201203113710.226751-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.84 on 10.5.11.22 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In this previous commit: commit 65491a2dfe00bfcf9f09a8d6eab60234b56c8cc4 Author: Martin Kletzander Date: Thu Nov 12 13:58:53 2020 +0100 Do not disable incompatible-pointer-types-discards-qualifiers We selectively rewrite G_DEFINE_TYPE to avoid warnings about mismatched volatile/non-volatile pointers that appeared with CLang when using GLib2 >=3D 2.67 We have now just hit the reverse problem, GCC >=3D 11 has started warning about mismatched volatile/non-volatile pointers but only with GLib2 < 2.67. The new GLib2 avoids the warning, as does older GCC. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/util/glibcompat.h | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/util/glibcompat.h b/src/util/glibcompat.h index 457f6ba797..455324925f 100644 --- a/src/util/glibcompat.h +++ b/src/util/glibcompat.h @@ -22,7 +22,10 @@ #include #include =20 -#if defined(__clang__) && GLIB_CHECK_VERSION(2, 67, 0) +#if GLIB_CHECK_VERSION(2, 67, 0) + +# if defined(__clang__) + /* * 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 @@ -34,16 +37,36 @@ * is defined in glib (with a very low probability of being changed thanks= to a * comment above it). */ -# undef _G_DEFINE_TYPE_EXTENDED_BEGIN +# undef _G_DEFINE_TYPE_EXTENDED_BEGIN =20 -# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, f= lags) \ +# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, = flags) \ _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") =20 -#endif /* __clang__ */ +# endif /* __clang__ */ + +#else /* GLib < 2.67.0 */ + +/* + * ...meanwhile GCC >=3D 11 has started issuing warnings about volatile + * from the old G_DEFINE_TYPE macro impl. IOW the new macros impls fixed + * new GCC, but broke CLang + */ +# if !defined(__clang__) && __GNUC_PREREQ (11, 0) +# undef _G_DEFINE_TYPE_EXTENDED_BEGIN + +# define _G_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, = flags) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wincompatible-pointer-types\"") \ + _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 */ + +#endif /* GLib < 2.67.0 */ =20 gchar * vir_g_canonicalize_filename(const gchar *filename, const gchar *relative_to); --=20 2.25.4