Skip to content

Set DMOD_CURRENT_ALLOCATOR on raw test executables - #19

Merged
JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq
Sep 19, 2026
Merged

JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Summary

Companion PR to choco-technologies/dmod#307, which requires DMOD_CURRENT_ALLOCATOR to be defined on the system side too (it used to default to NULL/anonymous there).

dmheap.c itself never calls Dmod_Malloc/Dmod_Free directly (dmheap is the allocator backend), and CMakeLists.txt already calls dmod's create_library_makefile(), which now sets DMOD_CURRENT_ALLOCATOR automatically for the dmheap library target - no source 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 though they don't call Dmod_Malloc themselves (the #error in dmod_sal.h fires on inclusion, not on use). Added dmod_set_current_allocator() for each of the three test executables.

Depends on

This needs choco-technologies/dmod#307 merged first.

Test plan

  • CI build (DMHEAP_BUILD_TESTS is off by default; verified the fix is needed by reading the #error's unconditional trigger on header inclusion in dmod_sal.h).

🤖 Generated with Claude Code

https://claude.ai/code/session_01E7dx6Rd66adYqPjRLyE1GM


Generated by Claude Code

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).
@JohnAmadis
JohnAmadis merged commit 5e9ebe3 into master Sep 19, 2026
@JohnAmadis
JohnAmadis deleted the claude/epic-hopper-jck8tq branch September 19, 2026 09:57
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