Skip to content

deep recursion test + improvements#45

Merged
anporumb merged 16 commits intomasterfrom
anporumb/add_deep_call_stack_test
Jan 22, 2026
Merged

deep recursion test + improvements#45
anporumb merged 16 commits intomasterfrom
anporumb/add_deep_call_stack_test

Conversation

@anporumb
Copy link

🔧 Build System & Warnings

 - Added VLD_WARNINGS_AS_ERRORS CMake option (ON by default) with /WX for compiler and linker
 - Upgraded to warning level 4 (/W4) from /W3
 - Fixed LNK4281 warning: Changed x64 DLL base address from 0x03200000 to 0x100000000 (>4GB for ASLR)

🐛 Bug Fixes

 - Fixed C4312: Rewrote CriticalSection class to track m_ownerThreadId explicitly instead of accessing internal CRITICAL_SECTION members
 - Fixed C5033: Removed deprecated register keyword in utility.cpp
 - Fixed C4996: Replaced deprecated std::codecvt with WideCharToMultiByte in Allocs.cpp
 - Fixed C4018: Signed/unsigned mismatch in testsuite.cpp
 - Fixed C4201: Added pragma for nameless struct/union in crtmfcpatch.h
 - Fixed wcstombs_s crash: STRUNCATE return value is not an error - fixed assertion in Print()

📦 Library Upgrade

 - Upgraded cppformat 1.1.0 (2015) → {fmt} 12.1.1 - complete replacement of lib/cppformat/
 - Updated callstack.cpp to use modern fmt::format_to_n() API
 - Added C4127 warning suppression for fmt headers (needed on CI)

🧪 Testing

 - Added deep_callstack_test: Stress test for VLD's Print() function with 300+ stack frames to verify truncation handling
 - Updated deprecated gtest macros (INSTANTIATE_TEST_CASE_P → INSTANTIATE_TEST_SUITE_P)

🏗️ Pipeline (devops.yml)

 - Added comment about ARM64 vcvarsall - ARM64-hosted tools not available in current VS image

📊 Stats

 - 154 files changed (+84,152 / -4,829 lines)
 - Most additions are from {fmt} 12.1.1 library replacement

- criticalsection.h: Replace internal CRITICAL_SECTION struct access with
  explicit thread ID tracking for IsLockedByCurrentThread()
- utility.cpp: Remove deprecated 'register' storage class keyword
- Allocs.cpp: Replace deprecated std::wstring_convert/codecvt with
  WideCharToMultiByte() Windows API
- basics.cpp, dynamic_app.cpp: Update deprecated INSTANTIATE_TEST_CASE_P
  to INSTANTIATE_TEST_SUITE_P (gtest modernization)
- testsuite.cpp: Fix signed/unsigned mismatch by using UINT/ULONG types
- Remove redundant VLD_FORCE_ENABLE macro definitions (already defined
  via CMake for non-Debug builds)
- Add deep_callstack_test for testing long stack trace handling

Both ARM64 and x64 builds now compile with zero warnings.
Enable treating compiler warnings as errors by default (/WX flag).
This ensures code quality by preventing warnings from accumulating.

Can be disabled with: cmake .. -DVLD_WARNINGS_AS_ERRORS=OFF
- CMakeLists.txt: Change /W3 to /W4 for stricter warnings
- crtmfcpatch.h: Suppress C4201 for intentional nameless struct/union
- callstack.cpp: Suppress C4127 for third-party cppformat library header
- utility.cpp: Wrap VLDVirtualProtect/Restore in #if !defined(_M_ARM64)
  since they're only used for x86/x64 trampoline detection
- utility.cpp, vld.cpp: Fix unused variable warnings with (void) cast

All warnings fixed consistently using (void)var pattern for debug-only
variables. Both ARM64 and x64 build clean with /W4 /WX.
- Replace ancient cppformat 1.1.0 (March 2015) with {fmt} 12.1.1
- Update callstack.cpp to use modern fmt::format_to_n() API
- Configure fmt library for static runtime to match VLD
- Suppress warnings-as-errors for third-party fmt code
- Eliminates deprecated stdext::checked_array_iterator warnings
STRUNCATE return value from wcstombs_s with _TRUNCATE flag is not an
error - it indicates successful truncation. Only assert on actual
conversion failures, not on truncated output.

This fixes Debug test failures with deep call stacks that exceed
the MAXMESSAGELENGTH buffer size.
Set DLL base address to 0x100000000 (4GB) for both x64 and ARM64
platforms for optimal ASLR (Address Space Layout Randomization).
Keep 0x03200000 only for x86 (32-bit) which cannot address above 4GB.
@anporumb
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@anporumb anporumb closed this Jan 22, 2026
@anporumb anporumb reopened this Jan 22, 2026
@anporumb
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@anporumb anporumb marked this pull request as ready for review January 22, 2026 14:44
@anporumb anporumb enabled auto-merge (squash) January 22, 2026 14:44
@anporumb
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@anporumb
Copy link
Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@dcristoloveanu dcristoloveanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@anporumb anporumb merged commit 4848ac1 into master Jan 22, 2026
8 checks passed
@anporumb anporumb deleted the anporumb/add_deep_call_stack_test branch January 22, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants