build: Fix build warnings on Windows (#32500)

Disable some code for Windows, which is causing build warnings. When it
cannot be easily disabled (mainly for the incomplete BHM and sandbox
feature), allow dead code.
This commit is contained in:
Martin Robinson 2024-06-15 16:31:36 +02:00 committed by GitHub
parent 6b6872831c
commit 7982f0dc27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 0 deletions

View file

@ -43,13 +43,17 @@ pub struct Registers {
pub frame_ptr: Address, pub frame_ptr: Address,
} }
#[allow(dead_code)]
pub struct NativeStack { pub struct NativeStack {
instruction_ptrs: [*mut std::ffi::c_void; MAX_NATIVE_FRAMES], instruction_ptrs: [*mut std::ffi::c_void; MAX_NATIVE_FRAMES],
#[allow(dead_code)]
stack_ptrs: [*mut std::ffi::c_void; MAX_NATIVE_FRAMES], stack_ptrs: [*mut std::ffi::c_void; MAX_NATIVE_FRAMES],
#[allow(dead_code)]
count: usize, count: usize,
} }
impl NativeStack { impl NativeStack {
#[allow(dead_code)]
pub fn new() -> Self { pub fn new() -> Self {
NativeStack { NativeStack {
instruction_ptrs: [ptr::null_mut(); MAX_NATIVE_FRAMES], instruction_ptrs: [ptr::null_mut(); MAX_NATIVE_FRAMES],
@ -58,6 +62,7 @@ impl NativeStack {
} }
} }
#[allow(dead_code)]
pub fn process_register( pub fn process_register(
&mut self, &mut self,
instruction_ptr: *mut std::ffi::c_void, instruction_ptr: *mut std::ffi::c_void,

View file

@ -243,6 +243,7 @@ fn setup_common<C: CommandMethods>(command: &mut C, token: String) {
} }
/// A trait to unify commands launched as multiprocess with or without a sandbox. /// A trait to unify commands launched as multiprocess with or without a sandbox.
#[allow(dead_code)]
trait CommandMethods { trait CommandMethods {
/// A command line argument. /// A command line argument.
fn arg<T>(&mut self, arg: T) fn arg<T>(&mut self, arg: T)

View file

@ -831,6 +831,7 @@ impl FontFamilyDescriptor {
/// ]; /// ];
/// let mapped_weight = apply_font_config_to_style_mapping(&mapping, weight as f64); /// let mapped_weight = apply_font_config_to_style_mapping(&mapping, weight as f64);
/// ``` /// ```
#[cfg(any(target_os = "linux", target_os = "macos"))]
pub(crate) fn map_platform_values_to_style_values(mapping: &[(f64, f64)], value: f64) -> f64 { pub(crate) fn map_platform_values_to_style_values(mapping: &[(f64, f64)], value: f64) -> f64 {
if value < mapping[0].0 { if value < mapping[0].0 {
return mapping[0].1; return mapping[0].1;

View file

@ -2,7 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#[cfg(any(target_os = "linux", target_os = "macos"))]
use base::text::{UnicodeBlock, UnicodeBlockMethod}; use base::text::{UnicodeBlock, UnicodeBlockMethod};
#[cfg(any(target_os = "linux", target_os = "macos"))]
use unicode_script::Script; use unicode_script::Script;
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
@ -11,6 +13,7 @@ pub use crate::platform::freetype::{font, font_list, library_handle};
pub use crate::platform::macos::{core_text_font_cache, font, font_list}; pub use crate::platform::macos::{core_text_font_cache, font, font_list};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub use crate::platform::windows::{font, font_list}; pub use crate::platform::windows::{font, font_list};
#[cfg(any(target_os = "linux", target_os = "macos"))]
use crate::text::FallbackFontSelectionOptions; use crate::text::FallbackFontSelectionOptions;
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]