qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/12] rust: macros: check that #[derive(Object)] requires #[repr


From: Paolo Bonzini
Subject: [PATCH 04/12] rust: macros: check that #[derive(Object)] requires #[repr(C)]
Date: Fri, 20 Dec 2024 15:29:46 +0100

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/qemu-api-macros/src/lib.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rust/qemu-api-macros/src/lib.rs b/rust/qemu-api-macros/src/lib.rs
index 778b698be45..0f04cca3841 100644
--- a/rust/qemu-api-macros/src/lib.rs
+++ b/rust/qemu-api-macros/src/lib.rs
@@ -54,6 +54,8 @@ fn is_c_repr(input: &DeriveInput, msg: &str) -> Result<(), 
CompileError> {
 }
 
 fn derive_object_or_error(input: DeriveInput) -> 
Result<proc_macro2::TokenStream, CompileError> {
+    is_c_repr(&input, "#[derive(Object)]")?;
+
     let name = &input.ident;
     let parent = &get_fields(&input, "#[derive(Object)]")?[0].ident;
 
-- 
2.47.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]