From e9a2f36b23b7e6479ee0fc7182107f431746dd14 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Wed, 4 Mar 2026 11:27:06 -0800 Subject: [PATCH] switch to internal debug mode detection macro for the element size check in radsort --- build.bat | 4 ++-- src/mule/mule_main.cpp | 5 +++++ src/third_party/radsort/radsort.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.bat b/build.bat index 94711724..67c197d3 100644 --- a/build.bat +++ b/build.bat @@ -69,8 +69,8 @@ if "%pgo%"=="1" ( :: --- Compile/Link Line Definitions ------------------------------------------ set cl_common= /I..\src\ /I..\local\ /nologo /FC /Z7 /Zc:preprocessor -set cl_debug= call cl /Od /Ob1 /DBUILD_DEBUG=1 /D_DEBUG %cl_common% %auto_compile_flags% -set cl_release= call cl /O2 /DBUILD_DEBUG=0 /DNDEBUG %cl_common% %auto_compile_flags% +set cl_debug= call cl /Od /Ob1 /DBUILD_DEBUG=1 %cl_common% %auto_compile_flags% +set cl_release= call cl /O2 /DBUILD_DEBUG=0 %cl_common% %auto_compile_flags% set cl_link= /link /MANIFEST:EMBED /INCREMENTAL:NO /pdbaltpath:%%%%_PDB%%%% /NATVIS:"%~dp0\src\natvis\base.natvis" /noexp /nocoffgrpinfo /opt:ref /opt:icf set cl_out= /out: set cl_linker= diff --git a/src/mule/mule_main.cpp b/src/mule/mule_main.cpp index 42204d0e..2d63ea6f 100644 --- a/src/mule/mule_main.cpp +++ b/src/mule/mule_main.cpp @@ -6,6 +6,11 @@ ** stepping, breakpoints, evaluation, cross-module calls. */ +#if COMPILER_MSVC && _DEBUG +#pragma comment(linker, "/nodefaultlib:libcmt") +#pragma comment(lib, "libcmtd") +#endif + #include #include #include diff --git a/src/third_party/radsort/radsort.h b/src/third_party/radsort/radsort.h index 752193e8..b1a48fdf 100644 --- a/src/third_party/radsort/radsort.h +++ b/src/third_party/radsort/radsort.h @@ -438,7 +438,7 @@ RSFORCEINLINE void radsortinternal( void * start, size_t len, size_t element_siz if ( len <= 1 ) return; -#if _DEBUG +#if BUILD_DEBUG if ( element_size > sizeof( RS_MAX_SIMPLE_BUF ) ) __debugbreak(); #endif