From nobody Fri May 3 13:59:30 2024 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=1627046390; cv=none; d=zohomail.com; s=zohoarc; b=HjWoTIAe7WvjcVnBatK4YPYZurH9wDPqksH9k/rXtZeCJ3Tp0kVmHYv0zW+lC1yKYX/GuyHlDRECfdCyUCdaDzZtyetYQnINabEWPxJuZbJ9chgg0zV/mdUclcVvf4Dn6sxuskxnsYCYQCCBiSFzkjzhcS0RxJEeE3R7XNNC8Yw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627046390; 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=EWIbMYmLXZqEwhP6YfwzjMHXsBybQSRo1icBOG32PcE=; b=bKIUynnrEpl36KxU+3dbAbu/WFLXXtjmgNU0RpGiMuYC+Jf8HtO62wtB9yInyF/UccAa+NBdjeiekW4su1VTyz4pY1Oib8ClDLr/aqvd8kIAF+JiCByyW4PNvFsZhF57gBD4mY35a9ferxnj6mFO+n0vyaslBEfktMKcFVGhe8s= 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) 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 1627046390047126.73247017244432; Fri, 23 Jul 2021 06:19:50 -0700 (PDT) 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-t4927sSqMZS5j8fqf1-Y_Q-1; Fri, 23 Jul 2021 09:19:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43C461005D57; Fri, 23 Jul 2021 13:19:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FDD418432; Fri, 23 Jul 2021 13:19:37 +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 6E3451806D0F; Fri, 23 Jul 2021 13:19:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16NDJTch013411 for ; Fri, 23 Jul 2021 09:19:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 470E019D7C; Fri, 23 Jul 2021 13:19:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-197.ams2.redhat.com [10.36.113.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62E9219C46; Fri, 23 Jul 2021 13:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627046388; 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=EWIbMYmLXZqEwhP6YfwzjMHXsBybQSRo1icBOG32PcE=; b=PIRcszEMmPDZG1NbNjzz7L5+LHXnzfgv38ig179n6amzjrky9GO1VzyzKD55sOS2/q6Vq3 BvN3Sv+pfGzThnh5QY5DlDgp3uthInH6J935GP+VDXjGjZI/06WkiRepj3DhtgTT8LWKJO aWP5ZuGdUHvp0q3w/O3t6s34OdvUGXw= X-MC-Unique: t4927sSqMZS5j8fqf1-Y_Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2] src: workaround warning triggered in glib 2.69 Date: Fri, 23 Jul 2021 14:19:25 +0100 Message-Id: <20210723131925.2798625-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.15 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) X-ZM-MESSAGEID: 1627046391771100001 Libvirt is using the G_GNUC_FALLTHROUGH macro provided by glib since version 2.60. Since we need to support older glib, we also have some compatibility code to define it if missing. We set the GLIB_VERSION_MAX_ALLOWED macro to ensure we get warnings when we use an API that dates from a glib version newer than our minimum benchmark. Historically this didn't get enforced for (most) macros, but GLib 2.69 has addressed that gap. This causes our usage of G_GNUC_FALLTHROUGH to trigger warnings. GLib is right to warn, because it does not know that we have added our own fallback for older versions. The only way to squelch this warning though, is to fully undefine the GLib provided G_GNUC_FALLTHROUGH and use our own in its place. We'll be able to remove all this compat burden when we finally update the min glib version to be >=3D 2.60 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Krempa --- src/internal.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/internal.h b/src/internal.h index 0a03dfc46f..e1250a59fe 100644 --- a/src/internal.h +++ b/src/internal.h @@ -147,8 +147,17 @@ * * silence the compiler warning when falling through a switch case * - * TODO: Remove after upgrading to GLib >=3D 2.60 + * Note: GLib 2.69.0 introduced version checks on the + * macro usage. Thus an app setting GLIB_VERSION_MAX_ALLOWED + * to less than 2.60 will trigger a warning using G_GNUC_FALLTHROUGH + * Normally the warning is a good thing, but we want to use our + * fallback impl, so we have to temporarily cull the GLib macro. + * + * All this should be removed once updating to min GLib >=3D 2.60 */ +#if GLIB_CHECK_VERSION(2, 69, 0) +# undef G_GNUC_FALLTHROUGH +#endif #ifndef G_GNUC_FALLTHROUGH # if __GNUC_PREREQ (7, 0) # define G_GNUC_FALLTHROUGH __attribute__((fallthrough)) --=20 2.31.1