diff --git a/src/minisketch/src/fields/clmul_common_impl.h b/src/minisketch/src/fields/clmul_common_impl.h index 2cecbf581ed..7cb43908e73 100644 --- a/src/minisketch/src/fields/clmul_common_impl.h +++ b/src/minisketch/src/fields/clmul_common_impl.h @@ -12,6 +12,7 @@ #include "../int_utils.h" #include "../lintrans.h" +#include "../util.h" namespace { @@ -28,7 +29,7 @@ namespace { # define NO_SANITIZE_MEMORY #endif -template NO_SANITIZE_MEMORY I MulWithClMulReduce(I a, I b) +template NO_SANITIZE_MEMORY MAYBE_UNUSED I MulWithClMulReduce(I a, I b) { static constexpr I MASK = Mask(); @@ -65,7 +66,7 @@ template NO_SANITIZE_MEMORY I MulWithClMulReduce(I } } -template NO_SANITIZE_MEMORY I MulTrinomial(I a, I b) +template NO_SANITIZE_MEMORY MAYBE_UNUSED I MulTrinomial(I a, I b) { static constexpr I MASK = Mask(); diff --git a/src/minisketch/src/util.h b/src/minisketch/src/util.h index fdb3f3a231d..50ee1aa09ab 100644 --- a/src/minisketch/src/util.h +++ b/src/minisketch/src/util.h @@ -26,6 +26,20 @@ #define EXPECT(x,c) (x) #endif +#if defined(__has_cpp_attribute) +# if __has_cpp_attribute(maybe_unused) +# define MAYBE_UNUSED [[maybe_unused]] +# endif +#endif + +#ifndef MAYBE_UNUSED +# if defined(__GNUC__) +# define MAYBE_UNUSED __attribute__((unused)) +# else +# define MAYBE_UNUSED +# endif +#endif + /* Assertion macros */ /**