-
Notifications
You must be signed in to change notification settings - Fork 922
chore(build): fix compilation warnings #5826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
21c1cac to
082fbbf
Compare
| } | ||
| } | ||
|
|
||
| pub(crate) struct VMExceptionRef(*mut wasm_ref_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be private. Why it needs to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The place where the type is exposed to a public API is here:
warning: type `backend::v8::vm::VMExceptionRef` is more private than the item `vm::VMExceptionRef::V8::0`
--> lib/api/src/vm/mod.rs:22:16
|
22 | V8(crate::backend::v8::vm::[<VM $name>]),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `vm::VMExceptionRef::V8::0` is reachable at visibility `pub`
...
445 | define_vm_like!(ExceptionRef);
| ----------------------------- in this macro invocation
|
note: but type `backend::v8::vm::VMExceptionRef` is only usable at visibility `pub(crate)`
| let mem_size: TypedFunction<(), i32> = instance | ||
| .exports | ||
| .get_typed_function(&mut store, "mem_size")?; | ||
| #[cfg(not(feature = "wamr"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not in wamr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the code down below makes use of the functions only conditionally:
Lines 112 to 145 in b4bff3c
| #[cfg(not(feature = "wamr"))] | |
| { | |
| // Here we are requesting two more pages for our memory. | |
| memory.grow(&mut store, 2)?; | |
| let memory_view = memory.view(&store); | |
| assert_eq!(memory_view.size(), Pages::from(3)); | |
| assert_eq!(memory_view.data_size(), 65536 * 3); | |
| // Now that we know how to query and adjust the size of the memory, | |
| // let's see how wa can write to it or read from it. | |
| // | |
| // We'll only focus on how to do this using exported functions, the goal | |
| // is to show how to work with memory addresses. Here we'll use absolute | |
| // addresses to write and read a value. | |
| let mem_addr = 0x2220; | |
| let val = 0xFEFEFFE; | |
| set_at.call(&mut store, mem_addr, val)?; | |
| let result = get_at.call(&mut store, mem_addr)?; | |
| println!("Value at {:#x?}: {:?}", mem_addr, result); | |
| assert_eq!(result, val); | |
| // Now instead of using hard coded memory addresses, let's try to write | |
| // something at the end of the second memory page and read it. | |
| let page_size = 0x1_0000; | |
| let mem_addr = (page_size * 2) - mem::size_of_val(&val) as i32; | |
| let val = 0xFEA09; | |
| set_at.call(&mut store, mem_addr, val)?; | |
| let result = get_at.call(&mut store, mem_addr)?; | |
| println!("Value at {:#x?}: {:?}", mem_addr, result); | |
| assert_eq!(result, val); | |
| } |
First part of the warning clean-up, these changes make it possible to run
cargo build --allwithout any warning.