Repository navigation
Set DMOD_CURRENT_ALLOCATOR on raw test executables - #19
Merged
Merged
Conversation
dmheap.c itself never calls Dmod_Malloc/Dmod_Free directly (dmheap is the allocator backend), and its CMakeLists.txt already calls dmod's create_library_makefile(), which now sets DMOD_CURRENT_ALLOCATOR automatically for the dmheap library target - no changes needed there. The three raw add_executable() test targets in tests/CMakeLists.txt don't go through that helper, though, and each includes dmheap.h, which pulls in the full dmod.h/dmod_sal.h - so they now need DMOD_CURRENT_ALLOCATOR defined too, even where they don't call Dmod_Malloc themselves. Added dmod_set_current_allocator() for each. Requires dmod's DMOD_CURRENT_ALLOCATOR system-side support (see choco-technologies/dmod#307).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion PR to choco-technologies/dmod#307, which requires
DMOD_CURRENT_ALLOCATORto be defined on the system side too (it used to default toNULL/anonymous there).dmheap.citself never callsDmod_Malloc/Dmod_Freedirectly (dmheap is the allocator backend), andCMakeLists.txtalready calls dmod'screate_library_makefile(), which now setsDMOD_CURRENT_ALLOCATORautomatically for thedmheaplibrary target - no source changes needed there.The three raw
add_executable()test targets intests/CMakeLists.txtdon't go through that helper though, and each includesdmheap.h, which pulls in the fulldmod.h/dmod_sal.h- so they now needDMOD_CURRENT_ALLOCATORdefined too, even though they don't callDmod_Mallocthemselves (the#errorindmod_sal.hfires on inclusion, not on use). Addeddmod_set_current_allocator()for each of the three test executables.Depends on
This needs choco-technologies/dmod#307 merged first.
Test plan
DMHEAP_BUILD_TESTSis off by default; verified the fix is needed by reading the#error's unconditional trigger on header inclusion indmod_sal.h).🤖 Generated with Claude Code
https://claude.ai/code/session_01E7dx6Rd66adYqPjRLyE1GM
Generated by Claude Code