[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/49] rust/qemu-api: Fix fragment-specifiers in define_property m
From: |
Paolo Bonzini |
Subject: |
[PULL 14/49] rust/qemu-api: Fix fragment-specifiers in define_property macro |
Date: |
Wed, 11 Dec 2024 17:26:44 +0100 |
From: Junjie Mao <junjie.mao@hotmail.com>
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 <junjie.mao@hotmail.com>
Co-developed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20241017143245.1248589-2-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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_class.rs
index 0ba798d3e3c..922bbce1bb8 100644
--- a/rust/qemu-api/src/device_class.rs
+++ b/rust/qemu-api/src/device_class.rs
@@ -27,7 +27,7 @@ macro_rules! device_class_init {
#[macro_export]
macro_rules! define_property {
- ($name:expr, $state:ty, $field:ident, $prop:expr, $type:expr, default =
$defval:expr$(,)*) => {
+ ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty, default =
$defval:expr$(,)*) => {
$crate::bindings::Property {
// use associated function syntax for type checking
name: ::std::ffi::CStr::as_ptr($name),
@@ -38,7 +38,7 @@ macro_rules! define_property {
..$crate::zeroable::Zeroable::ZERO
}
};
- ($name:expr, $state:ty, $field:ident, $prop:expr, $type:expr$(,)*) => {
+ ($name:expr, $state:ty, $field:ident, $prop:expr, $type:ty$(,)*) => {
$crate::bindings::Property {
// use associated function syntax for type checking
name: ::std::ffi::CStr::as_ptr($name),
--
2.47.1
- [PULL 04/49] rust: build: move rustc_args.py invocation to qemu-api crate, (continued)
- [PULL 04/49] rust: build: move rustc_args.py invocation to qemu-api crate, Paolo Bonzini, 2024/12/11
- [PULL 05/49] rust: build: restrict --cfg generation to only required symbols, Paolo Bonzini, 2024/12/11
- [PULL 03/49] rust: allow using build-root bindings.rs from cargo, Paolo Bonzini, 2024/12/11
- [PULL 06/49] rust: build: generate lint flags from Cargo.toml, Paolo Bonzini, 2024/12/11
- [PULL 07/49] rust: cargo: store desired warning levels in workspace Cargo.toml, Paolo Bonzini, 2024/12/11
- [PULL 09/49] rust: fix a couple style issues from clippy, Paolo Bonzini, 2024/12/11
- [PULL 10/49] rust: build: establish a baseline of lints across all crates, Paolo Bonzini, 2024/12/11
- [PULL 11/49] rust: build: add "make clippy", "make rustfmt", "make rustdoc", Paolo Bonzini, 2024/12/11
- [PULL 13/49] rust: fix doc test syntax, Paolo Bonzini, 2024/12/11
- [PULL 08/49] rust: build: move strict lints handling to rustc_args.py, Paolo Bonzini, 2024/12/11
- [PULL 14/49] rust/qemu-api: Fix fragment-specifiers in define_property macro,
Paolo Bonzini <=
- [PULL 12/49] rust: ci: add job that runs Rust tools, Paolo Bonzini, 2024/12/11
- [PULL 15/49] clock: clear callback on unparent, Paolo Bonzini, 2024/12/11
- [PULL 18/49] kvm: remove unnecessary #ifdef, Paolo Bonzini, 2024/12/11
- [PULL 16/49] clock: treat outputs and inputs the same in NamedClockList, Paolo Bonzini, 2024/12/11
- [PULL 17/49] clock: inline most of qdev_init_clocklist, Paolo Bonzini, 2024/12/11
- [PULL 20/49] hw/block: Replace type_register() with type_register_static(), Paolo Bonzini, 2024/12/11
- [PULL 19/49] arm: Replace type_register() with type_register_static(), Paolo Bonzini, 2024/12/11
- [PULL 21/49] hw/net: Replace type_register() with type_register_static(), Paolo Bonzini, 2024/12/11
- [PULL 22/49] ppc: Replace type_register() with type_register_static(), Paolo Bonzini, 2024/12/11