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:
@@ -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.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace snmalloc
|
||||
{
|
||||
if (SNMALLOC_UNLIKELY(!test))
|
||||
{
|
||||
if constexpr (!DEBUG)
|
||||
if constexpr (!Debug)
|
||||
{
|
||||
UNUSED(str, args...);
|
||||
SNMALLOC_FAST_FAIL();
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace snmalloc
|
||||
*/
|
||||
template<
|
||||
SNMALLOC_CONCEPT(RBRep) Rep,
|
||||
bool run_checks = DEBUG,
|
||||
bool run_checks = Debug,
|
||||
bool TRACE = false>
|
||||
class RBTree
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace snmalloc
|
||||
#ifdef SNMALLOC_CHECK_LOADS
|
||||
SNMALLOC_CHECK_LOADS
|
||||
#else
|
||||
DEBUG
|
||||
Debug
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user