From 686e7c1222a132e40e1dcfe63f6ab58796246687 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 29 Sep 2023 16:53:45 +0200 Subject: [PATCH 1/2] Suppress warnings in floaty when not on wasm32 --- contracts/floaty/src/contract.rs | 1 + contracts/floaty/src/instructions.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/floaty/src/contract.rs b/contracts/floaty/src/contract.rs index 668498a97c..9f7e8e4bff 100644 --- a/contracts/floaty/src/contract.rs +++ b/contracts/floaty/src/contract.rs @@ -33,6 +33,7 @@ pub fn query(_deps: Deps, _env: Env, msg: QueryMsg) -> StdResult } } +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_variables))] fn query_run(instruction: &str, args: Vec) -> StdResult { #[cfg(not(target_arch = "wasm32"))] panic!(); diff --git a/contracts/floaty/src/instructions.rs b/contracts/floaty/src/instructions.rs index d76fa28b19..d264330852 100644 --- a/contracts/floaty/src/instructions.rs +++ b/contracts/floaty/src/instructions.rs @@ -4,6 +4,7 @@ use rand_chacha::rand_core::RngCore; use crate::floats::{random_f32, random_f64}; /// Not intended for direct usage +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_macros))] macro_rules! run_instr { ($instr:expr, $input:expr, $input_ty:ty, $return_ty:ty) => {{ let input: $input_ty = $input; @@ -23,9 +24,11 @@ macro_rules! run_instr { ret }}; } +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_imports))] pub(crate) use run_instr; /// Helper to run a single WebAssembly instruction in a type-safe way +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_macros))] macro_rules! run { ("f32.eq", $input1:expr, $input2:expr) => { $crate::instructions::run_instr!("f32.eq", $input1, f32, $input2, f32, u32) @@ -244,6 +247,7 @@ macro_rules! run { $crate::instructions::run_instr!("i64.trunc_sat_f64_u", $input, f64, u64) }; } +#[cfg_attr(not(target_arch = "wasm32"), allow(unused_imports))] pub(crate) use run; #[cw_serde] @@ -471,7 +475,7 @@ pub fn random_args_for(instr: &str, rng: &mut impl RngCore) -> Vec { } } -pub const FLOAT_INSTRUCTIONS: [&'static str; 70] = [ +pub const FLOAT_INSTRUCTIONS: [&str; 70] = [ "f32.eq", "f32.ne", "f32.lt", From 347c6cbbdb2485e20a00b48c0b6110b215899c76 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 29 Sep 2023 16:53:58 +0200 Subject: [PATCH 2/2] Exclude floaty from devtool scripts --- devtools/check_contracts_full.sh | 1 + devtools/check_contracts_medium.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/devtools/check_contracts_full.sh b/devtools/check_contracts_full.sh index 5a77cdd36e..35947c1029 100755 --- a/devtools/check_contracts_full.sh +++ b/devtools/check_contracts_full.sh @@ -2,6 +2,7 @@ set -o errexit -o nounset -o pipefail command -v shellcheck >/dev/null && shellcheck "$0" +GLOBIGNORE="contracts/floaty/" for contract_dir in contracts/*/; do ( cd "$contract_dir" diff --git a/devtools/check_contracts_medium.sh b/devtools/check_contracts_medium.sh index 0dcf5346b3..e8ecc78ad6 100755 --- a/devtools/check_contracts_medium.sh +++ b/devtools/check_contracts_medium.sh @@ -2,6 +2,7 @@ set -o errexit -o nounset -o pipefail command -v shellcheck >/dev/null && shellcheck "$0" +GLOBIGNORE="contracts/floaty/" for contract_dir in contracts/*/; do ( cd "$contract_dir"