diff --git a/Makefile b/Makefile index 95999b237..1a26296ff 100644 --- a/Makefile +++ b/Makefile @@ -405,6 +405,10 @@ ci_test_web_js_api_parallel: build_web_js_api_parallel no_tfhe_typo: @./scripts/no_tfhe_typo.sh +.PHONY: no_dbg_log # Check we did not leave dbg macro calls in the rust code +no_dbg_log: + @./scripts/no_dbg_calls.sh + # # Benchmarks # @@ -509,10 +513,10 @@ sha256_bool: install_rs_check_toolchain --features=$(TARGET_ARCH_FEATURE),boolean .PHONY: pcc # pcc stands for pre commit checks -pcc: no_tfhe_typo check_fmt doc clippy_all check_compile_tests +pcc: no_tfhe_typo no_dbg_log check_fmt doc clippy_all check_compile_tests .PHONY: fpcc # pcc stands for pre commit checks, the f stands for fast -fpcc: no_tfhe_typo check_fmt doc clippy_fast check_compile_tests +fpcc: no_tfhe_typo no_dbg_log check_fmt doc clippy_fast check_compile_tests .PHONY: conformance # Automatically fix problems that can be fixed conformance: fmt diff --git a/scripts/no_dbg_calls.sh b/scripts/no_dbg_calls.sh new file mode 100755 index 000000000..039c9af2b --- /dev/null +++ b/scripts/no_dbg_calls.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +THIS_SCRIPT_NAME="$(basename "$0")" + +TMP_FILE="$(mktemp)" + +COUNT="$(git grep -rniI "dbg!" . | grep -v "${THIS_SCRIPT_NAME}" | \ + tee "${TMP_FILE}" | wc -l | tr -d '[:space:]')" + +cat "${TMP_FILE}" +rm -rf "${TMP_FILE}" + +if [[ "${COUNT}" == "0" ]]; then + exit 0 +else + echo "dbg macro calls detected, see output log above" + exit 1 +fi diff --git a/tfhe/src/integer/server_key/radix_parallel/scalar_rotate.rs b/tfhe/src/integer/server_key/radix_parallel/scalar_rotate.rs index e53b721d6..d997ccc68 100644 --- a/tfhe/src/integer/server_key/radix_parallel/scalar_rotate.rs +++ b/tfhe/src/integer/server_key/radix_parallel/scalar_rotate.rs @@ -601,8 +601,6 @@ impl ServerKey { let shift_within_block = n % num_bits_in_message; let num_blocks = ct.blocks.len(); - dbg!(rotations); - // rotate right as the blocks are from LSB to MSB ct.blocks.rotate_right(rotations); diff --git a/tfhe/src/integer/u256.rs b/tfhe/src/integer/u256.rs index 5638f6c5d..8dd024f30 100644 --- a/tfhe/src/integer/u256.rs +++ b/tfhe/src/integer/u256.rs @@ -160,7 +160,7 @@ impl U256 { pub fn leading_zeros(self) -> u32 { // iter from msb to lsb for (i, word) in self.0.iter().copied().rev().enumerate() { - let leading_zeros = dbg!(word.leading_zeros()); + let leading_zeros = word.leading_zeros(); if leading_zeros != u64::BITS { return (i as u32 * u64::BITS) + leading_zeros; }