Skip to content

Commit

Permalink
Move libafl_concolic to expect instead of allow
Browse files Browse the repository at this point in the history
  • Loading branch information
riesentoaster committed Dec 19, 2024
1 parent ae5a8dd commit 7f7fbc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
9 changes: 5 additions & 4 deletions libafl_concolic/symcc_runtime/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::collections::HashSet;

// required for the import the macro `invoke_macro_with_rust_runtime_exports` that is dynamically generated in build.rs
#[allow(clippy::wildcard_imports)]
use crate::*;

Expand All @@ -17,19 +18,19 @@ macro_rules! rust_filter_function_declaration {
// push_path_constraint is not caught by the following case (because it has not return value),
// but still needs to return something
(pub fn push_path_constraint($( $arg:ident : $type:ty ),*$(,)?), $c_name:ident;) => {
#[allow(unused_variables)]
#[allow(unused_variables)] // only unused for some macro invocations
fn push_path_constraint(&mut self, $($arg : $type),*) -> bool {
true
}
};

(pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?) -> $ret:ty, $c_name:ident;) => {
#[allow(unused_variables)]
#[allow(unused_variables)] // only unused for some macro invocations
fn $name(&mut self, $( $arg : $type),*) -> bool {true}
};

(pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?), $c_name:ident;) => {
#[allow(unused_variables)]
#[allow(unused_variables)] // only unused for some macro invocations
fn $name(&mut self, $( $arg : $type),*) {}
};
}
Expand Down Expand Up @@ -84,7 +85,7 @@ pub trait Filter {
///
/// It applies the filter before passing expressions to the inner runtime.
/// It also implements [`Runtime`], allowing for composing multiple [`Filter`]'s in a chain.
#[allow(clippy::module_name_repetitions)]
#[expect(clippy::module_name_repetitions)]
pub struct FilterRuntime<F, RT> {
filter: F,
runtime: RT,
Expand Down
4 changes: 2 additions & 2 deletions libafl_concolic/symcc_runtime/src/filter/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ impl<THasher: Hasher, THashBuilder: BuildHasher> CallStackCoverage<THasher, THas
self.pending = true;
}

#[allow(clippy::wrong_self_convention)]
pub fn is_interesting(&self) -> bool {
self.is_interesting
}
Expand Down Expand Up @@ -139,6 +138,7 @@ macro_rules! call_stack_coverage_filter_function_implementation {
};
}

// required for the import the macro `invoke_macro_with_rust_runtime_exports` that is dynamically generated in build.rs
#[allow(clippy::wildcard_imports)]
use crate::*;

Expand Down Expand Up @@ -189,7 +189,7 @@ where
}

fn register_location_on_hitmap(&mut self, location: usize) {
#[allow(clippy::cast_possible_truncation)] // we cannot have more than usize elements..
#[expect(clippy::cast_possible_truncation)] // we cannot have more than usize elements..
let hash = (self.build_hasher.hash_one(location) % usize::MAX as u64) as usize;
let val = unsafe {
// # Safety
Expand Down
14 changes: 7 additions & 7 deletions libafl_concolic/symcc_runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ macro_rules! unwrap_option {
macro_rules! export_rust_runtime_fn {
// special case for expression_unreachable, because we need to be convert pointer+length to slice
(pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)]
#[expect(clippy::missing_safety_doc)]
#[no_mangle]
pub unsafe extern "C" fn _rsym_expression_unreachable(expressions: *mut RSymExpr, num_elements: usize) {
let slice = core::slice::from_raw_parts(expressions, num_elements);
Expand All @@ -146,7 +146,7 @@ macro_rules! export_rust_runtime_fn {
};
// special case for push_path_constraint, we are not returning a new expression while taking an expression as argument
(pub fn push_path_constraint(constraint: RSymExpr, taken: bool, site_id: usize), $c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)]
#[expect(clippy::missing_safety_doc)]
#[no_mangle]
pub unsafe extern "C" fn _rsym_push_path_constraint(constraint: Option<RSymExpr>, taken: bool, site_id: usize) {
if let Some(constraint) = constraint {
Expand All @@ -160,7 +160,7 @@ macro_rules! export_rust_runtime_fn {
(pub fn build_integer_from_buffer(
buffer: *mut ::std::os::raw::c_void,
num_bits: ::std::os::raw::c_uint$(,)?) -> RSymExpr,$c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)]
#[expect(clippy::missing_safety_doc)]
#[no_mangle]
pub unsafe extern "C" fn _rsym_build_integer_from_buffer(buffer: *mut ::std::os::raw::c_void, num_bits: ::std::os::raw::c_uint) {
$rt_cb(|rt| {
Expand All @@ -170,7 +170,7 @@ macro_rules! export_rust_runtime_fn {
};
// all other methods are handled by this
(pub fn $name:ident($( $arg:ident : $(::)?$($type:ident)::+ ),*$(,)?)$( -> $($ret:ident)::+)?, $c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)]
#[expect(clippy::missing_safety_doc)]
#[no_mangle]
pub unsafe extern "C" fn $c_name( $($arg: $crate::make_symexpr_optional!($($type)::+),)* )$( -> $crate::make_symexpr_optional!($($ret)::+))? {
$rt_cb(|rt| {
Expand All @@ -185,12 +185,12 @@ macro_rules! export_rust_runtime_fn {
macro_rules! impl_nop_runtime_fn {
// special case for expression_unreachable, because it has a different signature in our runtime trait than in the c interface.
(pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident;) => {
#[allow(clippy::default_trait_access)]
// #[expect(clippy::default_trait_access)]
fn expression_unreachable(&mut self, _exprs: &[RSymExpr]) {std::default::Default::default()}
};

(pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?)$( -> $ret:ty)?, $c_name:ident;) => {
#[allow(clippy::default_trait_access)]
// #[expect(clippy::default_trait_access)]
fn $name(&mut self, $( _ : $type),*)$( -> Option<$ret>)? {std::default::Default::default()}
};
}
Expand Down Expand Up @@ -222,7 +222,7 @@ impl<RT> OptionalRuntime<RT> {

macro_rules! rust_runtime_function_declaration {
(pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident;) => {
#[allow(clippy::default_trait_access)]
// #[expect(clippy::default_trait_access)]
fn expression_unreachable(&mut self, exprs: &[RSymExpr]) {
if let Some(inner) = &mut self.inner {
inner.expression_unreachable(exprs);
Expand Down
7 changes: 3 additions & 4 deletions libafl_concolic/symcc_runtime/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl TracingRuntime {
}
}

#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn write_message(&mut self, message: SymExpr) -> Option<RSymExpr> {
Some(self.writer.write_message(message).unwrap())
}
Expand All @@ -35,14 +35,14 @@ impl TracingRuntime {
/// according to [`concolic::SymExpr`].
macro_rules! expression_builder {
($method_name:ident ( $($param_name:ident : $param_type:ty ),+ ) => $message:ident) => {
#[allow(clippy::missing_safety_doc)]
// #[expect(clippy::missing_safety_doc)]
#[no_mangle]
fn $method_name(&mut self, $( $param_name : $param_type, )+ ) -> Option<RSymExpr> {
self.write_message(SymExpr::$message { $($param_name,)+ })
}
};
($method_name:ident () => $message:ident) => {
#[allow(clippy::missing_safety_doc)]
// #[expect(clippy::missing_safety_doc)]
#[no_mangle]
fn $method_name(&mut self) -> Option<RSymExpr> {
self.write_message(SymExpr::$message)
Expand All @@ -63,7 +63,6 @@ macro_rules! binary_expression_builder {
}

impl Runtime for TracingRuntime {
#[allow(clippy::missing_safety_doc)]
#[no_mangle]
fn build_integer_from_buffer(
&mut self,
Expand Down

0 comments on commit 7f7fbc7

Please sign in to comment.