DemesneGH commented on code in PR #176:
URL: 
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/176#discussion_r2015542109


##########
optee-teec/macros/src/lib.rs:
##########
@@ -34,38 +34,56 @@ pub fn plugin_init(_args: TokenStream, input: TokenStream) 
-> TokenStream {
     let f = parse_macro_input!(input as syn::ItemFn);
     let f_vis = &f.vis;
     let f_block = &f.block;
-    let f_decl = &f.decl;
-    let f_inputs = &f_decl.inputs;
+    let f_sig = &f.sig;
+    let f_inputs = &f_sig.inputs;
 
     // check the function signature
-    let valid_signature = f.constness.is_none()
+    let valid_signature = f_sig.constness.is_none()
         && match f_vis {
             syn::Visibility::Inherited => true,
             _ => false,
         }
-        && f.abi.is_none()
+        && f_sig.abi.is_none()
         && f_inputs.len() == 0
-        && f.decl.generics.where_clause.is_none()
-        && f.decl.variadic.is_none();
+        && f_sig.generics.where_clause.is_none()
+        && f_sig.variadic.is_none()
+        && check_return_type(&f);
 
     if !valid_signature {
         return syn::parse::Error::new(
             f.span(),
-            "`#[plugin_init]` function must have signature `fn()`",
+            "`#[plugin_init]` function must have signature `fn() -> 
optee_teec::Result<()>`",
         )
         .to_compile_error()
         .into();
     }
 
     quote!(
-        #[no_mangle]
-        pub fn _plugin_init() -> optee_teec::Result<()> {
-            #f_block
-            Ok(())
+        pub fn _plugin_init() -> optee_teec::optee_teec_sys::TEEC_Result {

Review Comment:
   If we `pub use optee_teec_sys as raw;` , for consistency, other modules 
(e.g. `extension.rs`) in `optee-utee/src` can be updated, from `use 
optee_utee_sys as raw;` to `use crate::raw;` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org
For additional commands, e-mail: dev-h...@teaclave.apache.org

Reply via email to