From nobody Tue Feb 10 12:40:12 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1679921272; cv=none; d=zohomail.com; s=zohoarc; b=A+v56lnQkCsS08+fa/R53KURuFoy+3gqq3TQVt3ccsBscoHCCwJeplKdEAlrgKiWmQdIQ9TmDRElkEw/Eu3glTKr5S4v7YDsKyqNxu3oKB/bLtF+jiGx6tqDqC4PP9+ATryZ76VxCeo5MFS2ECSGIacHaR78EihZSU3Ca5H5JXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679921272; 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=rndeC0r1wknWv/c95Twj5xZQUW32HhmdvvdtHp9QsMk=; b=SIwDmL0e2tixEqLmk/suq2RwDb+q7KjI1WSxUMawOmhSAKk9rR3H4yaZuUBVjksHVNxggmmnkGJIsMyAFGYdpbp+jXA/CITt4wPlVY84dsm3jQWePNZ2bNAoaB9YD15HxN8VRhhxa1CSjRThJdcBCe8eW4mhht9yty+QV+9u9KY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1679921272307752.6563403168004; Mon, 27 Mar 2023 05:47:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-4sfcEEoAMUK2pWIvgT6Yvg-1; Mon, 27 Mar 2023 08:47:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1CBD53C0ED5A; Mon, 27 Mar 2023 12:47:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F8CD2166B26; Mon, 27 Mar 2023 12:47:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3C9041946594; Mon, 27 Mar 2023 12:47:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4FDF1194658F for ; Mon, 27 Mar 2023 12:47:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4166840BC797; Mon, 27 Mar 2023 12:47:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA1B840BC798 for ; Mon, 27 Mar 2023 12:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679921271; 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=rndeC0r1wknWv/c95Twj5xZQUW32HhmdvvdtHp9QsMk=; b=KM+RyavNd2+k9Wf0sEdQEFTWh/rv92WGdIOdZl/BBZfKhDcFQme4yDEYXdwrGodwYKu7px tqWL6uL+XFYRycYOUd+6pcK1WPjFF7nLpvKWu87wvVYa9Ol34f905sjaQapObkMI9GUBjg POwgO/fQqiPZqyFw4pswTFTm5nEO3z8= X-MC-Unique: 4sfcEEoAMUK2pWIvgT6Yvg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] tests: Compile virgdbusmock.c with GIO_COMPILATION enabled Date: Mon, 27 Mar 2023 14:47:40 +0200 Message-Id: <4ba4b8a79ec3221088cfea65be5f48ba92e3925f.1679921260.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679921273838100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There are couple of g_dbus_*() functions we provide an alternative implementation for in our virgdbusmock.c. However, these functions are declared in gio/gdbusconnection.h as: GIO_AVAILABLE_IN_ALL GDBusConnection *g_bus_get_sync (GBusType bus_type, GCancellable *cancellable, GError **error); where GIO_AVAILABLE_IN_ALL is declared as (in /gio/gio-visibility.h): #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GIO_STATIC_COMPI= LATION) # define _GIO_EXPORT __declspec(dllexport) # define _GIO_IMPORT __declspec(dllimport) #elif __GNUC__ >=3D 4 # define _GIO_EXPORT __attribute__((visibility("default"))) # define _GIO_IMPORT #else # define _GIO_EXPORT # define _GIO_IMPORT #endif #ifdef GIO_COMPILATION # define _GIO_API _GIO_EXPORT #else # define _GIO_API _GIO_IMPORT #endif #define _GIO_EXTERN _GIO_API extern #define GIO_AVAILABLE_IN_ALL _GIO_EXTERN Now, on mingw the functions we mock are declared with dllimport attribute which makes the compiler unhappy: ../tests/virgdbusmock.c:25:24: error: 'g_bus_get_sync' redeclared without dllimport attribute: previous dllimport ignored [-Werror=3Dattributes] The solution is to do what glib does when it compiles the gio module: set GIO_COMPILATION macro which in turn annotates the function with dllexport attribute. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- tests/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 0fd3bc62cf..6be806f4ae 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -65,6 +65,10 @@ else endif =20 =20 +virgdbusmock_dep =3D declare_dependency( + compile_args: [ '-DGIO_COMPILATION' ] +) + # mock_libs: # each entry is a dictionary with following items: # * name - mock library name which is also used as default source file n= ame (required) @@ -78,7 +82,7 @@ mock_libs =3D [ { 'name': 'virdnsmasqmock' }, { 'name': 'virfilecachemock' }, { 'name': 'virfirewallmock' }, - { 'name': 'virgdbusmock' }, + { 'name': 'virgdbusmock', 'deps': [ virgdbusmock_dep] }, { 'name': 'virhostcpumock' }, { 'name': 'virhostdevmock' }, { 'name': 'virnetdaemonmock' }, --=20 2.39.2