Changing DEBUG constexpr to Debug to avoid collision with any #define DEBUG that may exist in other projects. (#729)

Co-authored-by: Neil Monday <neil.monday@amd.com>
This commit is contained in:
Neil Monday
2025-01-08 12:13:26 -05:00
committed by GitHub
parent d1c65c2852
commit 6a3c5750bd
10 changed files with 11 additions and 11 deletions

View File

@@ -118,9 +118,9 @@
namespace snmalloc
{
#ifdef NDEBUG
static constexpr bool DEBUG = false;
static constexpr bool Debug = false;
#else
static constexpr bool DEBUG = true;
static constexpr bool Debug = true;
#endif
// Forwards reference so that the platform can define how to handle errors.

View File

@@ -19,7 +19,7 @@ namespace snmalloc
{
if (SNMALLOC_UNLIKELY(!test))
{
if constexpr (!DEBUG)
if constexpr (!Debug)
{
UNUSED(str, args...);
SNMALLOC_FAST_FAIL();

View File

@@ -86,7 +86,7 @@ namespace snmalloc
*/
template<
SNMALLOC_CONCEPT(RBRep) Rep,
bool run_checks = DEBUG,
bool run_checks = Debug,
bool TRACE = false>
class RBTree
{

View File

@@ -12,7 +12,7 @@ namespace snmalloc
#ifdef SNMALLOC_CHECK_LOADS
SNMALLOC_CHECK_LOADS
#else
DEBUG
Debug
#endif
;

View File

@@ -144,7 +144,7 @@ namespace snmalloc
{
SNMALLOC_ASSERT(is_aligned_block<page_size>(p, size));
if constexpr (DEBUG)
if constexpr (Debug)
memset(p, 0x5a, size);
// `MADV_FREE_REUSABLE` can only be applied to writable pages,

View File

@@ -35,7 +35,7 @@ namespace snmalloc
{
SNMALLOC_ASSERT(is_aligned_block<OS::page_size>(p, size));
if constexpr (DEBUG)
if constexpr (Debug)
memset(p, 0x5a, size);
madvise(p, size, MADV_FREE);

View File

@@ -80,7 +80,7 @@ namespace snmalloc
{
SNMALLOC_ASSERT(is_aligned_block<page_size>(p, size));
if constexpr (DEBUG)
if constexpr (Debug)
memset(p, 0x5a, size);
madvise(p, size, MADV_FREE);

View File

@@ -130,7 +130,7 @@ namespace snmalloc
// Fill memory so that when we switch the pages back on we don't make
// assumptions on the content.
if constexpr (DEBUG)
if constexpr (Debug)
memset(p, 0x5a, size);
madvise(p, size, madvise_free_flags);

View File

@@ -215,7 +215,7 @@ namespace snmalloc
{
// Fill memory so that when we switch the pages back on we don't make
// assumptions on the content.
if constexpr (DEBUG)
if constexpr (Debug)
memset(p, 0x5a, size);
mprotect(p, size, PROT_NONE);

View File

@@ -96,7 +96,7 @@ int main(int, char**)
xoroshiro::p128r64 r;
size_t nn = snmalloc::DEBUG ? 30 : 3;
size_t nn = snmalloc::Debug ? 30 : 3;
for (size_t n = 0; n < nn; n++)
test::test_external_pointer(r);