Skip to content

Commit be21fae

Browse files
authored
Remove useless cfgs (AFLplusplus#2764)
1 parent cc442f4 commit be21fae

File tree

8 files changed

+11
-17
lines changed

8 files changed

+11
-17
lines changed

libafl/src/corpus/cached.rs

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

libafl/src/corpus/inmemory_ondisk.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
77
use alloc::string::String;
88
use core::cell::RefCell;
9-
#[cfg(feature = "std")]
10-
use std::{fs, fs::File, io::Write};
119
use std::{
12-
fs::OpenOptions,
10+
fs,
11+
fs::{File, OpenOptions},
1312
io,
13+
io::Write,
1414
path::{Path, PathBuf},
1515
};
1616

@@ -50,7 +50,6 @@ fn try_create_new<P: AsRef<Path>>(path: P) -> Result<Option<File>, io::Error> {
5050
/// A corpus able to store [`Testcase`]s to disk, while also keeping all of them in memory.
5151
///
5252
/// Metadata is written to a `.<filename>.metadata` file in the same folder by default.
53-
#[cfg(feature = "std")]
5453
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
5554
pub struct InMemoryOnDiskCorpus<I> {
5655
inner: InMemoryCorpus<I>,

libafl/src/corpus/ondisk.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::{
2222
};
2323

2424
/// Options for the the format of the on-disk metadata
25-
#[cfg(feature = "std")]
2625
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
2726
pub enum OnDiskMetadataFormat {
2827
/// A binary-encoded postcard

libafl/src/executors/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ pub trait CommandConfigurator<I, C = Child>: Sized {
862862
}
863863

864864
/// waitpid wrapper that ignores some signals sent by the ptraced child
865-
#[cfg(all(feature = "std", target_os = "linux"))]
865+
#[cfg(target_os = "linux")]
866866
fn waitpid_filtered(pid: Pid, options: Option<WaitPidFlag>) -> Result<WaitStatus, Errno> {
867867
loop {
868868
let wait_status = waitpid(pid, options);

libafl/src/executors/hooks/timer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) struct Itimerval {
5858
pub it_value: Timeval,
5959
}
6060

61-
#[cfg(all(feature = "std", unix, not(target_os = "linux")))]
61+
#[cfg(all(unix, not(target_os = "linux")))]
6262
extern "C" {
6363
pub(crate) fn setitimer(
6464
which: libc::c_int,
@@ -102,7 +102,7 @@ pub struct TimerStruct {
102102
pub(crate) tmout_start_time: Duration,
103103
}
104104

105-
#[cfg(all(feature = "std", windows))]
105+
#[cfg(windows)]
106106
#[allow(non_camel_case_types)]
107107
type PTP_TIMER_CALLBACK = unsafe extern "system" fn(
108108
param0: PTP_CALLBACK_INSTANCE,

libafl/src/executors/inprocess_fork/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ pub mod child_signal_handlers {
349349
}
350350

351351
#[cfg(test)]
352-
#[cfg(all(feature = "std", feature = "fork", unix))]
352+
#[cfg(all(feature = "fork", unix))]
353353
mod tests {
354354
use libafl_bolts::tuples::tuple_list;
355355
use serial_test::serial;

libafl/src/observers/stdio.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! The [`StdOutObserver`] and [`StdErrObserver`] observers look at the stdout of a program
44
//! The executor must explicitly support these observers.
55
#![cfg_attr(
6-
all(feature = "std", unix),
6+
unix,
77
doc = r"For example, they are supported on the [`crate::executors::CommandExecutor`]."
88
)]
99

@@ -19,11 +19,8 @@ use crate::{observers::Observer, Error};
1919
/// Only works for supported executors.
2020
///
2121
/// # Example usage
22-
#[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
23-
#[cfg_attr(
24-
not(all(feature = "std", target_os = "linux", not(miri))),
25-
doc = " ```ignore"
26-
)]
22+
#[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
23+
#[cfg_attr(not(all(target_os = "linux", not(miri))), doc = " ```ignore")]
2724
/// use std::borrow::Cow;
2825
///
2926
/// use libafl::{

libafl/src/stages/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ where
282282
client_config: EventConfig::AlwaysUnique,
283283
time: current_time(),
284284
forward_id: None,
285-
#[cfg(all(unix, feature = "std", feature = "multi_machine"))]
285+
#[cfg(all(unix, feature = "multi_machine"))]
286286
node_id: None,
287287
},
288288
)?;

0 commit comments

Comments
 (0)