From nobody Wed Oct 23 00:40:14 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1729174617; cv=none; d=zohomail.com; s=zohoarc; b=Zt0eu5As/PzIiCGeLBGP/r61SxyJuJzCEZj7YqfT0vQJpFzYBLmnCs0yMJRyThhXxQDQOj/opgFwQEe2Z55deKRZZNy1tBklba9DGV370Ezqb/cSIQ+WIjB/DCMyi9BM/L+Ak0DVZp/C6WF48QZ/Apb+DnjQGm2Aw01YN9w5n3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729174617; 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=NOaX4eLKri43EaiwXpWf3m2jalzAJQaisehBjjdZoqM=; b=FELdPQknDTdNRskMVHxfSqafth2wMCVdb44VlEUwEA+I22jqIOm3Cmkw4H2KXZ8Xvqkka/aJMo2pc2sYMUet2tZqFG2Ifh5xUnibh8RCw6y4Z7vWTXDC6qMU+Xua000Z5Y5x6JOVZiLUAXYXEk2n8u43MZhDAhOk3u89yLCJW1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1729174617333500.4787314003014; Thu, 17 Oct 2024 07:16:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t1RIx-0001KU-Ua; Thu, 17 Oct 2024 10:16:43 -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 1t1RIw-0001KD-Gm for qemu-devel@nongnu.org; Thu, 17 Oct 2024 10:16:42 -0400 Received: from mgamail.intel.com ([192.198.163.9]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t1RIu-0002JQ-KZ for qemu-devel@nongnu.org; Thu, 17 Oct 2024 10:16:41 -0400 Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 07:16:38 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa010.fm.intel.com with ESMTP; 17 Oct 2024 07:16:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729174601; x=1760710601; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zNtyLbF2NaEtnWKH8mXKsOb2TpHKY3e2pLSl8z5LJkE=; b=PT7HHEP9NONXcC8f1/qz+DLhoTlmK+trtWKAe72Ws6WHZI89llM9YxdU w39nSTVs3+mx17HxlqhOqWR8kL7NSmvl76DkBc9W4TltGY09vQCA2GvLS bpHuQawM5OU1dJ74GbAcVLsIWel4xexsmADM53jvzpo+TGz58r3B8gA3c KNneIG9Dti7djdeyf500cFSreM8rA/5XoZOX3EN6U5Rj6m8J57A8bOExH ptEZdJW9APJxBhGv/o9Ufd8JXKRQapaQMQP3LbYvWWTr3VMu31LN/lbL3 pA+F+fZcO9Jkhq/Zy1dcHgMEg+NXJG7QdT05fRHWIQOtx5rCnHagKuYYQ g==; X-CSE-ConnectionGUID: c3WvVi5pSsGymKxlpHr6Ig== X-CSE-MsgGUID: e0/p4nNvTeiFGAD14csVJw== X-IronPort-AV: E=McAfee;i="6700,10204,11228"; a="39299383" X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="39299383" X-CSE-ConnectionGUID: M3Cq/5AmS7+V5XzAPIxIRA== X-CSE-MsgGUID: 1zrriyKdTU2W5gXAu9AUbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="78900048" From: Zhao Liu To: Manos Pitsidianakis , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Cc: qemu-devel@nongnu.org, Junjie Mao , Zhao Liu Subject: [RFC 1/2] rust/qemu-api: Fix fragment-specifiers in define_property macro Date: Thu, 17 Oct 2024 22:32:44 +0800 Message-Id: <20241017143245.1248589-2-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241017143245.1248589-1-zhao1.liu@intel.com> References: <20241017143245.1248589-1-zhao1.liu@intel.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=192.198.163.9; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.068, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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 @intel.com) X-ZM-MESSAGEID: 1729174693928116600 Content-Type: text/plain; charset="utf-8" From: Junjie Mao For the matcher of macro, "expr" is used for expressions, while "ident" is used for variable/function names, and "ty" matches types. In define_property macro, $field is a member name of type $state, so it should be defined as "ident", though offset_of! doesn't complain about this. $type is the type of $field, since it is not used in the macro, so that no type mismatch error is triggered either. Fix fragment-specifiers of $field and $type. Signed-off-by: Junjie Mao Co-developed-by: Zhao Liu Signed-off-by: Zhao Liu --- rust/qemu-api/src/device_class.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/qemu-api/src/device_class.rs b/rust/qemu-api/src/device_c= lass.rs index 1ea95beb78db..be363fd63223 100644 --- a/rust/qemu-api/src/device_class.rs +++ b/rust/qemu-api/src/device_class.rs @@ -26,7 +26,7 @@ macro_rules! device_class_init { =20 #[macro_export] macro_rules! define_property { - ($name:expr, $state:ty, $field:expr, $prop:expr, $type:expr, default = =3D $defval:expr$(,)*) =3D> { + ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty, default = =3D $defval:expr$(,)*) =3D> { $crate::bindings::Property { name: { #[used] @@ -47,7 +47,7 @@ macro_rules! define_property { link_type: ::core::ptr::null(), } }; - ($name:expr, $state:ty, $field:expr, $prop:expr, $type:expr$(,)*) =3D>= { + ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty$(,)*) =3D> { $crate::bindings::Property { name: { #[used] --=20 2.34.1