Skip to content

Commit

Permalink
Fix macos compilation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Jan 7, 2025
1 parent 965ff40 commit a487851
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/polkavm/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use alloc::vec::Vec;

use polkavm_common::abi::{MemoryMap, MemoryMapBuilder, VM_ADDR_RETURN_TO_HOST};
use polkavm_common::cast::cast;
#[cfg_attr(not(target_os = "linux"), allow(unused_imports))]
use polkavm_common::program::{
build_static_dispatch_table, FrameKind, ISA32_V1_NoSbrk, ISA64_V1_NoSbrk, Imports, InstructionSet, Instructions, JumpTable, Opcode,
ProgramBlob, Reg, ISA32_V1, ISA64_V1,
Expand Down Expand Up @@ -226,6 +227,7 @@ impl CompiledModuleKind {
}

pub(crate) struct ModulePrivate {
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
engine_state: Option<Arc<EngineState>>,
crosscheck: bool,

Expand Down Expand Up @@ -282,6 +284,7 @@ impl Module {
self.state().dynamic_paging
}

#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub(crate) fn compiled_module(&self) -> &CompiledModuleKind {
&self.state().compiled_module
}
Expand Down Expand Up @@ -340,6 +343,7 @@ impl Module {
self.round_to_page_size_down(value) + (u32::from((value & self.state().page_size_mask) != 0) << self.state().page_shift)
}

#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub(crate) fn address_to_page(&self, address: u32) -> u32 {
address >> self.state().page_shift
}
Expand Down Expand Up @@ -407,6 +411,7 @@ impl Module {
}
};

#[cfg_attr(not(target_os = "linux"), allow(unused_variables))]
let exports = {
log::trace!("Parsing exports...");
let mut exports = Vec::with_capacity(1);
Expand Down
1 change: 1 addition & 0 deletions crates/polkavm/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ where
B: CompilerBitness,
{
#[allow(clippy::too_many_arguments)]
#[cfg(target_os = "linux")]
pub(crate) fn new(
cache: &CompilerCache,
config: &'a ModuleConfig,
Expand Down
1 change: 1 addition & 0 deletions crates/polkavm/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl Error {
}

#[cold]
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub(crate) fn context(self, message: impl core::fmt::Display) -> Self {
let string = match self.0 {
ErrorKind::Owned(buffer) => format!("{}: {}", message, buffer),
Expand Down
1 change: 1 addition & 0 deletions crates/polkavm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ mod config;
mod gas;
mod interpreter;
mod linker;
#[cfg(any(test, target_os = "linux"))]
mod page_set;
#[cfg(feature = "std")]
mod source_cache;
Expand Down
1 change: 1 addition & 0 deletions crates/polkavm/src/mutex_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ impl<T> Mutex<T> {
}

#[inline]
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub fn lock(&self) -> std::sync::MutexGuard<T> {
match self.0.lock() {
Ok(mutable) => mutable,
Expand Down
1 change: 1 addition & 0 deletions crates/polkavm/src/page_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ impl PageSet {
}
}

#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub fn clear(&mut self) {
self.intervals.clear();
}
Expand Down
3 changes: 3 additions & 0 deletions crates/polkavm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ where
}

#[inline]
#[cfg(target_os = "linux")]
pub fn new_reusing_memory(mut memory: Self, capacity: u32) -> Self {
memory.inner.clear();
memory.inner.resize_with(capacity as usize, || None);
Expand All @@ -72,6 +73,7 @@ where
}

#[inline]
#[cfg(target_os = "linux")]
pub fn len(&self) -> u32 {
self.inner.len() as u32
}
Expand All @@ -82,6 +84,7 @@ where
}

#[inline]
#[cfg(target_os = "linux")]
pub fn clear(&mut self) {
self.inner.clear();
}
Expand Down

0 comments on commit a487851

Please sign in to comment.