From nobody Sat Nov 23 20:44:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730125946; cv=none; d=zohomail.com; s=zohoarc; b=K8xpip3q8pvvWomJUFw5y9oEaOLAWZG7vi4HMTSnZxAtmflDsrmIudYfOKw8IQ+MA2KzHH81pTCeCSxxGFu+o5PrS7vCiy58qEixvmxBEgLWrU/xaxLS3oGwnKeIAjYscqcsBpyo8B/UEm+gg20QZXnijJ5Blqdjvlsc2eQ5Wo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730125946; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e6dzvxdvUD9f5+tb1x3QNv8ncs9HO3QkAP+Z/lD+THw=; b=I4Oeds8Vf5YbUzf5MxPGDF0rgtiB2T0uoFjG+y1iQ+p3AFEPBSoKnimX0U3yVF7WRoy8HmEcHvDlL8BBKDHWHhM76nVxV1lhMan46CfJP8EciIrv9EsFhfN/aDpCM1vQ4f1mKshohbKpaNYx6LQasWmoMFWbK1Pp8YiMu1qvsv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730125946066608.82767697531; Mon, 28 Oct 2024 07:32:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5Qle-0001Jg-R4; Mon, 28 Oct 2024 10:30:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5Ql5-0000Li-VH for qemu-devel@nongnu.org; Mon, 28 Oct 2024 10:30:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5Ql3-0003lZ-0E for qemu-devel@nongnu.org; Mon, 28 Oct 2024 10:30:15 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-UJzBYOW9OAOI0_KcbeYAaA-1; Mon, 28 Oct 2024 10:30:04 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d4854fa0eso2144823f8f.2 for ; Mon, 28 Oct 2024 07:30:04 -0700 (PDT) Received: from [192.168.10.3] ([151.49.226.83]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b712cbsm9675079f8f.77.2024.10.28.07.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 07:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730125806; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e6dzvxdvUD9f5+tb1x3QNv8ncs9HO3QkAP+Z/lD+THw=; b=V9cEGu/+puA5xQw5XPAsvZHjo9no2V4RPpyfesgKU44QgNyor/5tc6xlBvx4Fr6jSzHdX9 M8lomFVRBlxi8Yt+R26N+DWy1NhgTmd2NslR7c6fzBhlRN+6SUkXhkp1k64iYSZHfNTw5L i8B3wrjEBiXUqomYFdwCRFW9+Ra5fTQ= X-MC-Unique: UJzBYOW9OAOI0_KcbeYAaA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730125802; x=1730730602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e6dzvxdvUD9f5+tb1x3QNv8ncs9HO3QkAP+Z/lD+THw=; b=cCqTIj+Gd6rDTcYrRQCD75jqa7HD7NVSOrMeIvNxTtUDtUYZCokXtmRBYCFQPcP7x3 rWIxxzwFsuQZXBkK7gdS4JBAfvtXKqQLKvABDt9raytBVduyh+EAwXVsxBCiW1/zkqHV 2PrMMqd5P68lOQPfi14QOj0Zb2O455bwjg/CCNop/Cj/7/T+vQzOLLwiRWAkxFeZcEhB 6XxCMqKNnVRTAO7SwjCpErcJ5gWFjbqBz/f79Scb6hOur3HlVqN5lxxYYys6pWUBCYdA s+urB10Dqjlefc5iYjJI4VkNoRyfGrCCcNtb6j911I2ca0eY8Ci6FErvaB0SrCBE95FI FnFg== X-Gm-Message-State: AOJu0Yy4/21rDk72HAsUYBiuCMaKy7m4Kk3XGREcYxVAiqlybOjKnGqe d7Yn3KMIIYbnjs9TgrDJOtPYqsJr/d3H+8tbwOoc7uc/lBd01KT1sWaiP7cDxKc8bTZYlvVgPrf GBL2fkeCKUN22aMvWJX+3l9c4hdwOiXDY7uVDvwsDeVFhGqpty+vvDfEpMp83rJZL2u4OvDTtPR UxL1A/ASiISdFhFyx1NWLgPG5RSBn+jHzd4/K8FSg= X-Received: by 2002:adf:efca:0:b0:37d:4b07:606b with SMTP id ffacd0b85a97d-380611e0fd1mr5978566f8f.36.1730125802535; Mon, 28 Oct 2024 07:30:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAqN3JyuLnWU5F1AhVZqWvpubhQ9PAAzD3KGBL1xyVJHHmz/6bFxKX4UhfHMPN2Zq8w6+6GA== X-Received: by 2002:adf:efca:0:b0:37d:4b07:606b with SMTP id ffacd0b85a97d-380611e0fd1mr5978541f8f.36.1730125802053; Mon, 28 Oct 2024 07:30:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Junjie Mao , Kevin Wolf Subject: [PULL 11/24] meson: pass rustc_args when building all crates Date: Mon, 28 Oct 2024 15:29:18 +0100 Message-ID: <20241028142932.363687-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241028142932.363687-1-pbonzini@redhat.com> References: <20241028142932.363687-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.373, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1730125947192116600 Content-Type: text/plain; charset="utf-8" rustc_args is needed to smooth the difference in warnings between the vario= us versions of rustc. Always include those arguments. Reviewed-by: Junjie Mao Reviewed-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- meson.build | 20 +++++++++++++------- rust/qemu-api/meson.build | 2 +- rust/qemu-api/src/device_class.rs | 10 ++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 0f1de0db2d9..0b8c3495eab 100644 --- a/meson.build +++ b/meson.build @@ -3317,6 +3317,19 @@ endif =20 genh +=3D configure_file(output: 'config-host.h', configuration: config_ho= st_data) =20 +if have_rust and have_system + rustc_args =3D run_command( + find_program('scripts/rust/rustc_args.py'), + '--config-headers', meson.project_build_root() / 'config-host.h', + capture : true, + check: true).stdout().strip().split() + + # Prohibit code that is forbidden in Rust 2024 + rustc_args +=3D ['-D', 'unsafe_op_in_unsafe_fn'] + add_project_arguments(rustc_args, native: false, language: 'rust') + add_project_arguments(rustc_args, native: true, language: 'rust') +endif + hxtool =3D find_program('scripts/hxtool') shaderinclude =3D find_program('scripts/shaderinclude.py') qapi_gen =3D find_program('scripts/qapi-gen.py') @@ -3909,12 +3922,6 @@ common_all =3D static_library('common', dependencies: common_ss.all_dependencies()) =20 if have_rust and have_system - rustc_args =3D run_command( - find_program('scripts/rust/rustc_args.py'), - '--config-headers', meson.project_build_root() / 'config-host.h', - capture : true, - check: true).stdout().strip().split() - rustc_args +=3D ['-D', 'unsafe_op_in_unsafe_fn'] bindgen_args =3D [ '--disable-header-comment', '--raw-line', '// @generated', @@ -4087,7 +4094,6 @@ foreach target : target_dirs rlib_rs, dependencies: target_rust.dependencies(), override_options: ['rust_std=3D2021', 'build.r= ust_std=3D2021'], - rust_args: rustc_args, rust_abi: 'c') arch_deps +=3D declare_dependency(link_whole: [rlib]) endif diff --git a/rust/qemu-api/meson.build b/rust/qemu-api/meson.build index c72d34b607d..42ea815fa5a 100644 --- a/rust/qemu-api/meson.build +++ b/rust/qemu-api/meson.build @@ -10,7 +10,7 @@ _qemu_api_rs =3D static_library( ), override_options: ['rust_std=3D2021', 'build.rust_std=3D2021'], rust_abi: 'rust', - rust_args: rustc_args + [ + rust_args: [ '--cfg', 'MESON', # '--cfg', 'feature=3D"allocator"', ], diff --git a/rust/qemu-api/src/device_class.rs b/rust/qemu-api/src/device_c= lass.rs index 1ea95beb78d..b6b68cf9ce2 100644 --- a/rust/qemu-api/src/device_class.rs +++ b/rust/qemu-api/src/device_class.rs @@ -16,10 +16,12 @@ macro_rules! device_class_init { ) { let mut dc =3D ::core::ptr::NonNull::new(klass.cast::<$crate::bindings::D= eviceClass>()).unwrap(); - dc.as_mut().realize =3D $realize_fn; - dc.as_mut().vmsd =3D &$vmsd; - $crate::bindings::device_class_set_legacy_reset(dc.as_mut(), $= legacy_reset_fn); - $crate::bindings::device_class_set_props(dc.as_mut(), $props.a= s_mut_ptr()); + unsafe { + dc.as_mut().realize =3D $realize_fn; + dc.as_mut().vmsd =3D &$vmsd; + $crate::bindings::device_class_set_legacy_reset(dc.as_mut(= ), $legacy_reset_fn); + $crate::bindings::device_class_set_props(dc.as_mut(), $pro= ps.as_mut_ptr()); + } } }; } --=20 2.47.0