Remove useless cfgs (#2764)

This commit is contained in:
Dongjia "toka" Zhang 2024-12-12 22:02:34 +01:00 committed by GitHub
parent cc442f4dc8
commit be21fae490
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 11 additions and 17 deletions

View File

@ -18,7 +18,6 @@ use crate::{
/// A corpus that keeps a maximum number of [`Testcase`]s in memory /// A corpus that keeps a maximum number of [`Testcase`]s in memory
/// and load them from disk, when they are being used. /// and load them from disk, when they are being used.
/// The eviction policy is FIFO. /// The eviction policy is FIFO.
#[cfg(feature = "std")]
#[derive(Default, Serialize, Deserialize, Clone, Debug)] #[derive(Default, Serialize, Deserialize, Clone, Debug)]
pub struct CachedOnDiskCorpus<I> { pub struct CachedOnDiskCorpus<I> {
inner: InMemoryOnDiskCorpus<I>, inner: InMemoryOnDiskCorpus<I>,

View File

@ -6,11 +6,11 @@
use alloc::string::String; use alloc::string::String;
use core::cell::RefCell; use core::cell::RefCell;
#[cfg(feature = "std")]
use std::{fs, fs::File, io::Write};
use std::{ use std::{
fs::OpenOptions, fs,
fs::{File, OpenOptions},
io, io,
io::Write,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
@ -50,7 +50,6 @@ fn try_create_new<P: AsRef<Path>>(path: P) -> Result<Option<File>, io::Error> {
/// A corpus able to store [`Testcase`]s to disk, while also keeping all of them in memory. /// A corpus able to store [`Testcase`]s to disk, while also keeping all of them in memory.
/// ///
/// Metadata is written to a `.<filename>.metadata` file in the same folder by default. /// Metadata is written to a `.<filename>.metadata` file in the same folder by default.
#[cfg(feature = "std")]
#[derive(Default, Serialize, Deserialize, Clone, Debug)] #[derive(Default, Serialize, Deserialize, Clone, Debug)]
pub struct InMemoryOnDiskCorpus<I> { pub struct InMemoryOnDiskCorpus<I> {
inner: InMemoryCorpus<I>, inner: InMemoryCorpus<I>,

View File

@ -22,7 +22,6 @@ use crate::{
}; };
/// Options for the the format of the on-disk metadata /// Options for the the format of the on-disk metadata
#[cfg(feature = "std")]
#[derive(Default, Debug, Clone, Serialize, Deserialize)] #[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub enum OnDiskMetadataFormat { pub enum OnDiskMetadataFormat {
/// A binary-encoded postcard /// A binary-encoded postcard

View File

@ -862,7 +862,7 @@ pub trait CommandConfigurator<I, C = Child>: Sized {
} }
/// waitpid wrapper that ignores some signals sent by the ptraced child /// waitpid wrapper that ignores some signals sent by the ptraced child
#[cfg(all(feature = "std", target_os = "linux"))] #[cfg(target_os = "linux")]
fn waitpid_filtered(pid: Pid, options: Option<WaitPidFlag>) -> Result<WaitStatus, Errno> { fn waitpid_filtered(pid: Pid, options: Option<WaitPidFlag>) -> Result<WaitStatus, Errno> {
loop { loop {
let wait_status = waitpid(pid, options); let wait_status = waitpid(pid, options);

View File

@ -58,7 +58,7 @@ pub(crate) struct Itimerval {
pub it_value: Timeval, pub it_value: Timeval,
} }
#[cfg(all(feature = "std", unix, not(target_os = "linux")))] #[cfg(all(unix, not(target_os = "linux")))]
extern "C" { extern "C" {
pub(crate) fn setitimer( pub(crate) fn setitimer(
which: libc::c_int, which: libc::c_int,
@ -102,7 +102,7 @@ pub struct TimerStruct {
pub(crate) tmout_start_time: Duration, pub(crate) tmout_start_time: Duration,
} }
#[cfg(all(feature = "std", windows))] #[cfg(windows)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
type PTP_TIMER_CALLBACK = unsafe extern "system" fn( type PTP_TIMER_CALLBACK = unsafe extern "system" fn(
param0: PTP_CALLBACK_INSTANCE, param0: PTP_CALLBACK_INSTANCE,

View File

@ -349,7 +349,7 @@ pub mod child_signal_handlers {
} }
#[cfg(test)] #[cfg(test)]
#[cfg(all(feature = "std", feature = "fork", unix))] #[cfg(all(feature = "fork", unix))]
mod tests { mod tests {
use libafl_bolts::tuples::tuple_list; use libafl_bolts::tuples::tuple_list;
use serial_test::serial; use serial_test::serial;

View File

@ -3,7 +3,7 @@
//! The [`StdOutObserver`] and [`StdErrObserver`] observers look at the stdout of a program //! The [`StdOutObserver`] and [`StdErrObserver`] observers look at the stdout of a program
//! The executor must explicitly support these observers. //! The executor must explicitly support these observers.
#![cfg_attr( #![cfg_attr(
all(feature = "std", unix), unix,
doc = r"For example, they are supported on the [`crate::executors::CommandExecutor`]." doc = r"For example, they are supported on the [`crate::executors::CommandExecutor`]."
)] )]
@ -19,11 +19,8 @@ use crate::{observers::Observer, Error};
/// Only works for supported executors. /// Only works for supported executors.
/// ///
/// # Example usage /// # Example usage
#[cfg_attr(all(feature = "std", target_os = "linux", not(miri)), doc = " ```")] // miri doesn't like the Command crate, linux as a shorthand for the availability of base64 #[cfg_attr(all(target_os = "linux", not(miri)), doc = " ```")] // miri doesn't like the Command crate, linux as a shorthand for the availability of base64
#[cfg_attr( #[cfg_attr(not(all(target_os = "linux", not(miri))), doc = " ```ignore")]
not(all(feature = "std", target_os = "linux", not(miri))),
doc = " ```ignore"
)]
/// use std::borrow::Cow; /// use std::borrow::Cow;
/// ///
/// use libafl::{ /// use libafl::{

View File

@ -282,7 +282,7 @@ where
client_config: EventConfig::AlwaysUnique, client_config: EventConfig::AlwaysUnique,
time: current_time(), time: current_time(),
forward_id: None, forward_id: None,
#[cfg(all(unix, feature = "std", feature = "multi_machine"))] #[cfg(all(unix, feature = "multi_machine"))]
node_id: None, node_id: None,
}, },
)?; )?;