app/bin/unittest/CMakeLists.txt's getargstest target (added under SF #796, JSON Note
phase 1) compiles app/bin/misc.c a second time as a separate translation unit, with
XTRKCAD_TESTBUILD_NO_WMAIN defined to stub out wMain()'s body -- see the long comment
above the target in that file for why (MinGW/Windows linking couldn't drop wMain()'s
~90-symbol transitive call graph via --gc-sections the way Linux/macOS could).
The test only actually needs two functions from misc.c: ConvertToEscapedText() and
ConvertFromEscapedText(). Everything else in the file (which is large -- wMain() and
its exclusive helper functions, window/menu/audio/splash-screen init, etc.) is dead
weight for this target, compiled only to be discarded at link time via
-ffunction-sections/--gc-sections.
Immediate symptom already fixed (2026-09-16, same branch): three of misc.c's
wMain()-only static helpers (SetAccelKeys, OfferCheckpoint, AccelKeyDispatch,
NextWindow, and the verbose/accelKeyNames statics they touch) started showing up as
"defined but not used"/"unused variable" in the compiler-warnings QA report
(https://adbyrne.github.io/XTrkCAD/compiler-warnings/) the moment
XTRKCAD_TESTBUILD_NO_WMAIN excluded their only caller. Patched by extending the same
every future wMain()-exclusive helper added to misc.c will trip the same warning
unless someone remembers to guard it too. That's a standing trap, not a one-time fix.
Proposed real fix: extract ConvertToEscapedText()/ConvertFromEscapedText() (and
whatever minimal static helpers they call) out of misc.c into their own small file
(e.g. app/bin/escapetext.c, mirroring how getargs.c is already isolated per the
CMakeLists.txt comment's own note: "misc.c is NOT isolated the way getargs.c is").
getargstest would then compile only that new file (plus getargs.c/mymalloc.c as
today), never touching misc.c at all -- eliminating this whole class of warning
permanently instead of chasing it guard-by-guard, and shrinking the getargstest
target's compile+link surface as a side benefit.
Scope: pure refactor, no behavior change intended. Touches only misc.c (function
removal), the new extracted file, and
app/bin/unittest/CMakeLists.txt's getargstest target sources. Verify via GetArgsTest
(CMocka) still passing and the compiler-warnings report staying at 0 findings for
misc.c/the new file. GTK3V2MAIN only -- getargstest doesn't exist on default/GTK2.
Deliberately deferred: not blocking, not urgent, and lower priority than the
in-flight feature work (Layer Groups / Reports / JSON Note phase 2+ per #795). Pick
up after that work lands.
Anonymous
Fix is on the bug-796-json-note-phase1-gtk3 Hg branch (same branch as SF #796), pushed to SF. Flipping to needs-review pending merge into Hg mainline, same as #796.