From f17e49e9aac5c7ccd78059c3af208915f2db2aea Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Thu, 5 Oct 2023 15:25:55 +0200 Subject: [PATCH] Remove warnings (#1609) * two falgs * UNIX ONLY FLAGS * moa * FMT --- libafl_bolts/src/lib.rs | 3 ++- libafl_targets/build.rs | 27 ++++++++++++++++++++++----- libafl_tinyinst/src/lib.rs | 3 ++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/libafl_bolts/src/lib.rs b/libafl_bolts/src/lib.rs index 906d29e37f..a1cc6518c0 100644 --- a/libafl_bolts/src/lib.rs +++ b/libafl_bolts/src/lib.rs @@ -28,7 +28,8 @@ clippy::missing_panics_doc, clippy::missing_docs_in_private_items, clippy::module_name_repetitions, - clippy::ptr_cast_constness + clippy::ptr_cast_constness, + clippy::negative_feature_names )] #![cfg_attr(not(test), warn( missing_debug_implementations, diff --git a/libafl_targets/build.rs b/libafl_targets/build.rs index 43e40ca1a1..6d2415998e 100644 --- a/libafl_targets/build.rs +++ b/libafl_targets/build.rs @@ -58,6 +58,9 @@ fn main() { let mut sancov_cmp = cc::Build::new(); + #[cfg(unix)] + sancov_cmp.flag("-Wno-sign-compare"); + #[cfg(feature = "sancov_value_profile")] { sancov_cmp.define("SANCOV_VALUE_PROFILE", "1"); @@ -150,11 +153,25 @@ fn main() { println!("cargo:rerun-if-changed=src/cmplog.h"); println!("cargo:rerun-if-changed=src/cmplog.c"); - cc::Build::new() - .define("CMPLOG_MAP_W", Some(&*format!("{cmplog_map_w}"))) - .define("CMPLOG_MAP_H", Some(&*format!("{cmplog_map_h}"))) - .file(src_dir.join("cmplog.c")) - .compile("cmplog"); + #[cfg(unix)] + { + cc::Build::new() + .flag("-Wno-pointer-sign") // UNIX ONLY FLAGS + .flag("-Wno-sign-compare") + .define("CMPLOG_MAP_W", Some(&*format!("{cmplog_map_w}"))) + .define("CMPLOG_MAP_H", Some(&*format!("{cmplog_map_h}"))) + .file(src_dir.join("cmplog.c")) + .compile("cmplog"); + } + + #[cfg(not(unix))] + { + cc::Build::new() + .define("CMPLOG_MAP_W", Some(&*format!("{cmplog_map_w}"))) + .define("CMPLOG_MAP_H", Some(&*format!("{cmplog_map_h}"))) + .file(src_dir.join("cmplog.c")) + .compile("cmplog"); + } #[cfg(unix)] { diff --git a/libafl_tinyinst/src/lib.rs b/libafl_tinyinst/src/lib.rs index ffd4c26edd..e68c4607d0 100644 --- a/libafl_tinyinst/src/lib.rs +++ b/libafl_tinyinst/src/lib.rs @@ -17,7 +17,8 @@ The tinyinst module for `LibAFL`. clippy::missing_panics_doc, clippy::missing_docs_in_private_items, clippy::module_name_repetitions, - clippy::unreadable_literal + clippy::unreadable_literal, + clippy::negative_feature_names )] #![cfg_attr(not(test), warn( missing_debug_implementations,