summaryrefslogtreecommitdiff
path: root/src/testgenerate.c
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-03 17:01:58 -0700
committerScott Gasch <[email protected]>2026-09-03 17:01:58 -0700
commit6d76699e44f2ed0fb2368ccf0a19ae692a2d4697 (patch)
tree1984904fa82e5bc2626364e0ca28c00179938a3b /src/testgenerate.c
parent5441d2a6ce12eb4169e9d1f194a333684474dc5f (diff)
Fix all build warnings across release/DEBUG/TEST profiles
Clean gmake GENETIC=1 PERF_COUNTERS=1 MP=1 SIXTYFOUR=1 build had 100 warnings; DEBUG=1 and TEST=1 builds had more once actually exercised. - OFFSET_OF/CONTAINING_STRUCT (chess.h) and PTR_TO_ALLOC_HASH (unix.c) truncated pointers through 32-bit ULONG before use in offset/hash arithmetic on this 64-bit build -- routed through size_t instead. - Diagnostic int<->void* round-trips (command.c, root.c, split.c, sig.c, data.c, unix.c, util.c) widened/narrowed via size_t to avoid implicit truncation. - ABS_DIFF on unsigned COOR now casts to int before abs(). - Dropped -fexpensive-optimizations (GCC-only, clang silently ignores it) from GNUmakefile. - Removed genuinely dead variables (book.c, gamelist.c, split.c, testgenerate.c, testhash.c). - Guarded DEBUG/PERF_COUNTERS/_X86_-only variables and the _CMEvidenceBucket helper under the #ifdef that actually reads them, since ASSERT/EVAL_TERM/KEEP_TRACK_OF_FIRST_MOVE_FHs compile away outside those builds. - Added missing prototypes for SlidePawn, SlidePawnWithoutSigs, SlidePieceWithoutSigs (move.c), previously undeclared in chess.h. - Removed dead _SystemIsRoot (unix.c). Verified via precommit_check.sh: TEST=1 self-test suite passes, DEBUG=1 smoke test (10 random ECM positions, sd 4) passes with no crashes/assertions, release build restored -- all three profiles now build with zero warnings. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014Cmv11sJZqVfanrPh6UnWE
Diffstat (limited to 'src/testgenerate.c')
-rwxr-xr-xsrc/testgenerate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/testgenerate.c b/src/testgenerate.c
index d789fed..5fdf30f 100755
--- a/src/testgenerate.c
+++ b/src/testgenerate.c
@@ -36,7 +36,6 @@ PlyTest(SEARCHER_THREAD_CONTEXT *ctx,
ULONG u;
MOVE mv;
ULONG uPly = ctx->uPly;
- ULONG uLegalMoves = 0;
FLAG fGivesCheck;
#if DEBUG
POSITION board;
@@ -66,7 +65,6 @@ PlyTest(SEARCHER_THREAD_CONTEXT *ctx,
if (MakeMove(ctx, mv))
{
- uLegalMoves++;
ASSERT(!InCheck(&ctx->sPosition, GET_COLOR(mv.pMoved)));
fGivesCheck = IS_CHECKING_MOVE(mv);
#ifdef DEBUG
@@ -165,9 +163,10 @@ TestLegalMoveGenerator(void)
POSITION pos;
SEARCHER_THREAD_CONTEXT *ctx;
MOVE mv;
+#ifdef DEBUG
ULONG uLegalKingMoves;
+#endif
ULONG uTotalLegalMoves;
- ULONG uGen;
Trace("Testing legal move generator...\n");
ctx = SystemAllocateMemory(sizeof(SEARCHER_THREAD_CONTEXT));
@@ -199,7 +198,10 @@ TestLegalMoveGenerator(void)
if (TRUE == InCheck(&pos, pos.uToMove))
{
- uLegalKingMoves = uTotalLegalMoves = 0;
+#ifdef DEBUG
+ uLegalKingMoves = 0;
+#endif
+ uTotalLegalMoves = 0;
InitializeSearcherContext(&pos, ctx);
mv.uMove = 0;
@@ -213,10 +215,12 @@ TestLegalMoveGenerator(void)
if (TRUE == MakeMove(ctx, mv))
{
uTotalLegalMoves++;
+#ifdef DEBUG
if (IS_KING(mv.pMoved))
{
uLegalKingMoves++;
}
+#endif
UnmakeMove(ctx, mv);
}
else