Skip to content

Commit

Permalink
Remove useless cfgs (AFLplusplus#2764)
Browse files Browse the repository at this point in the history
  • Loading branch information
tokatoka authored Dec 12, 2024
1 parent cc442f4 commit be21fae
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 17 deletions.
1 change: 0 additions & 1 deletion libafl/src/corpus/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use crate::{
/// A corpus that keeps a maximum number of [`Testcase`]s in memory
/// and load them from disk, when they are being used.
/// The eviction policy is FIFO.
#[cfg(feature = "std")]
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
pub struct CachedOnDiskCorpus<I> {
inner: InMemoryOnDiskCorpus<I>,
Expand Down
7 changes: 3 additions & 4 deletions libafl/src/corpus/inmemory_ondisk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use alloc::string::String;
use core::cell::RefCell;
#[cfg(feature = "std")]
use std::{fs, fs::File, io::Write};
use std::{
fs::OpenOptions,
fs,
fs::{File, OpenOptions},
io,
io::Write,
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -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.
///
/// Metadata is written to a `.<filename>.metadata` file in the same folder by default.
#[cfg(feature = "std")]
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
pub struct InMemoryOnDiskCorpus<I> {
inner: InMemoryCorpus<I>,
Expand Down
1 change: 0 additions & 1 deletion libafl/src/corpus/ondisk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::{
};

/// Options for the the format of the on-disk metadata
#[cfg(feature = "std")]
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub enum OnDiskMetadataFormat {
/// A binary-encoded postcard
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/executors/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ pub trait CommandConfigurator<I, C = Child>: Sized {
}

/// 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> {
loop {
let wait_status = waitpid(pid, options);
Expand Down
4 changes: 2 additions & 2 deletions libafl/src/executors/hooks/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub(crate) struct Itimerval {
pub it_value: Timeval,
}

#[cfg(all(feature = "std", unix, not(target_os = "linux")))]
#[cfg(all(unix, not(target_os = "linux")))]
extern "C" {
pub(crate) fn setitimer(
which: libc::c_int,
Expand Down Expand Up @@ -102,7 +102,7 @@ pub struct TimerStruct {
pub(crate) tmout_start_time: Duration,
}

#[cfg(all(feature = "std", windows))]
#[cfg(windows)]
#[allow(non_camel_case_types)]
type PTP_TIMER_CALLBACK = unsafe extern "system" fn(
param0: PTP_CALLBACK_INSTANCE,
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/executors/inprocess_fork/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ pub mod child_signal_handlers {
}

#[cfg(test)]
#[cfg(all(feature = "std", feature = "fork", unix))]
#[cfg(all(feature = "fork", unix))]
mod tests {
use libafl_bolts::tuples::tuple_list;
use serial_test::serial;
Expand Down
9 changes: 3 additions & 6 deletions libafl/src/observers/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! The [`StdOutObserver`] and [`StdErrObserver`] observers look at the stdout of a program
//! The executor must explicitly support these observers.
#![cfg_attr(
all(feature = "std", unix),
unix,
doc = r"For example, they are supported on the [`crate::executors::CommandExecutor`]."
)]

Expand All @@ -19,11 +19,8 @@ use crate::{observers::Observer, Error};
/// Only works for supported executors.
///
/// # 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(
not(all(feature = "std", target_os = "linux", not(miri))),
doc = " ```ignore"
)]
#[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(not(all(target_os = "linux", not(miri))), doc = " ```ignore")]
/// use std::borrow::Cow;
///
/// use libafl::{
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/stages/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ where
client_config: EventConfig::AlwaysUnique,
time: current_time(),
forward_id: None,
#[cfg(all(unix, feature = "std", feature = "multi_machine"))]
#[cfg(all(unix, feature = "multi_machine"))]
node_id: None,
},
)?;
Expand Down

0 comments on commit be21fae

Please sign in to comment.