diff --git a/src/backend/address_space_core.h b/src/backend/address_space_core.h index f348542..d050790 100644 --- a/src/backend/address_space_core.h +++ b/src/backend/address_space_core.h @@ -65,8 +65,7 @@ namespace snmalloc bits::align_up(address_cast(base), bits::one_at_bit(align_bits))); // All blocks need to be bigger than a pointer. SNMALLOC_ASSERT(bits::one_at_bit(align_bits) >= sizeof(void*)); - UNUSED(base); - UNUSED(align_bits); + UNUSED(base, align_bits); } /** diff --git a/src/ds/defines.h b/src/ds/defines.h index 946f5b2..69b9106 100644 --- a/src/ds/defines.h +++ b/src/ds/defines.h @@ -90,8 +90,6 @@ # define __has_builtin(x) 0 #endif -#define UNUSED(x) ((void)(x)) - namespace snmalloc { // Forwards reference so that the platform can define how to handle errors. @@ -168,4 +166,7 @@ namespace snmalloc #else static constexpr bool CHECK_CLIENT = false; #endif + template + SNMALLOC_FAST_PATH_INLINE void UNUSED(Args&&...) + {} } // namespace snmalloc diff --git a/src/mem/allocstats.h b/src/mem/allocstats.h index 18896c6..2d3ae45 100644 --- a/src/mem/allocstats.h +++ b/src/mem/allocstats.h @@ -322,9 +322,7 @@ namespace snmalloc template void print(std::ostream& o, uint64_t dumpid = 0, uint64_t allocatorid = 0) { - UNUSED(o); - UNUSED(dumpid); - UNUSED(allocatorid); + UNUSED(o, dumpid, allocatorid); CSVStream csv(&o); diff --git a/src/mem/globalalloc.h b/src/mem/globalalloc.h index 2a0b9ca..f32413e 100644 --- a/src/mem/globalalloc.h +++ b/src/mem/globalalloc.h @@ -44,8 +44,7 @@ namespace snmalloc template inline static void print_all_stats(void*& o, uint64_t dumpid = 0) { - UNUSED(o); - UNUSED(dumpid); + UNUSED(o, dumpid); } #endif diff --git a/src/override/memcpy.cc b/src/override/memcpy.cc index b854e16..43c27b2 100644 --- a/src/override/memcpy.cc +++ b/src/override/memcpy.cc @@ -141,9 +141,7 @@ namespace { if constexpr (FailFast) { - UNUSED(ptr); - UNUSED(len); - UNUSED(msg); + UNUSED(ptr, len, msg); SNMALLOC_FAST_FAIL(); } else @@ -154,9 +152,7 @@ namespace } else { - UNUSED(ptr); - UNUSED(len); - UNUSED(msg); + UNUSED(ptr, len, msg); } } diff --git a/src/pal/pal_noalloc.h b/src/pal/pal_noalloc.h index 8228d44..9092b65 100644 --- a/src/pal/pal_noalloc.h +++ b/src/pal/pal_noalloc.h @@ -77,8 +77,7 @@ namespace snmalloc } else { - UNUSED(p); - UNUSED(size); + UNUSED(p, size); } } diff --git a/src/pal/pal_plain.h b/src/pal/pal_plain.h index 57bfe18..27230f2 100644 --- a/src/pal/pal_plain.h +++ b/src/pal/pal_plain.h @@ -24,8 +24,7 @@ namespace snmalloc } else { - UNUSED(p); - UNUSED(size); + UNUSED(p, size); } } }; diff --git a/src/pal/pal_posix.h b/src/pal/pal_posix.h index c4b85ab..e75020d 100644 --- a/src/pal/pal_posix.h +++ b/src/pal/pal_posix.h @@ -194,8 +194,7 @@ namespace snmalloc } else { - UNUSED(p); - UNUSED(size); + UNUSED(p, size); } } @@ -216,8 +215,7 @@ namespace snmalloc mprotect(p, size, PROT_READ | PROT_WRITE); else { - UNUSED(p); - UNUSED(size); + UNUSED(p, size); } if constexpr (zero_mem == YesZero) @@ -238,8 +236,7 @@ namespace snmalloc mprotect(p, size, PROT_READ); else { - UNUSED(p); - UNUSED(size); + UNUSED(p, size); } } diff --git a/src/test/func/bits/bits.cc b/src/test/func/bits/bits.cc index f78be0b..874c5fb 100644 --- a/src/test/func/bits/bits.cc +++ b/src/test/func/bits/bits.cc @@ -35,8 +35,7 @@ void test_clz() int main(int argc, char** argv) { - UNUSED(argc); - UNUSED(argv); + snmalloc::UNUSED(argc, argv); setup(); diff --git a/src/test/func/memory/memory.cc b/src/test/func/memory/memory.cc index 6185c5a..5127285 100644 --- a/src/test/func/memory/memory.cc +++ b/src/test/func/memory/memory.cc @@ -27,8 +27,7 @@ using namespace snmalloc; void test_limited(rlim64_t as_limit, size_t& count) { - UNUSED(as_limit); - UNUSED(count); + UNUSED(as_limit, count); #if false && defined(TEST_LIMITED) auto pid = fork(); if (!pid) @@ -490,8 +489,7 @@ int main(int argc, char** argv) size_t seed = opt.is("--seed", 0); Virtual::systematic_bump_ptr() += seed << 17; #else - UNUSED(argc); - UNUSED(argv); + UNUSED(argc, argv); #endif test_alloc_dealloc_64k(); test_random_allocation(); diff --git a/src/test/func/pagemap/pagemap.cc b/src/test/func/pagemap/pagemap.cc index d9be283..410ba8c 100644 --- a/src/test/func/pagemap/pagemap.cc +++ b/src/test/func/pagemap/pagemap.cc @@ -120,8 +120,7 @@ void test_pagemap(bool bounded) int main(int argc, char** argv) { - UNUSED(argc); - UNUSED(argv); + UNUSED(argc, argv); setup(); diff --git a/src/test/func/pool/pool.cc b/src/test/func/pool/pool.cc index f479f4e..7d63e9e 100644 --- a/src/test/func/pool/pool.cc +++ b/src/test/func/pool/pool.cc @@ -124,8 +124,7 @@ int main(int argc, char** argv) size_t seed = opt.is("--seed", 0); Virtual::systematic_bump_ptr() += seed << 17; #else - UNUSED(argc); - UNUSED(argv); + UNUSED(argc, argv); #endif test_alloc(); diff --git a/src/test/func/two_alloc_types/main.cc b/src/test/func/two_alloc_types/main.cc index b722a7e..3cea54c 100644 --- a/src/test/func/two_alloc_types/main.cc +++ b/src/test/func/two_alloc_types/main.cc @@ -7,14 +7,13 @@ extern "C" void* oe_memset_s(void* p, size_t p_size, int c, size_t size) { - UNUSED(p_size); + snmalloc::UNUSED(p_size); return memset(p, c, size); } extern "C" int oe_random(void* p, size_t p_size) { - UNUSED(p_size); - UNUSED(p); + snmalloc::UNUSED(p_size, p); // Stub for random data. return 0; } diff --git a/src/test/setup.h b/src/test/setup.h index bcf3035..319902e 100644 --- a/src/test/setup.h +++ b/src/test/setup.h @@ -63,7 +63,7 @@ void print_stack_trace() void _cdecl error(int signal) { - UNUSED(signal); + snmalloc::UNUSED(signal); puts("*****ABORT******"); print_stack_trace(); @@ -73,7 +73,7 @@ void _cdecl error(int signal) LONG WINAPI VectoredHandler(struct _EXCEPTION_POINTERS* ExceptionInfo) { - UNUSED(ExceptionInfo); + snmalloc::UNUSED(ExceptionInfo); puts("*****UNHANDLED EXCEPTION******"); @@ -100,7 +100,7 @@ void setup() # include void error_handle(int signal) { - UNUSED(signal); + snmalloc::UNUSED(signal); snmalloc::error("Seg Fault"); _exit(1); }