summaryrefslogtreecommitdiff
path: root/src/generate.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/generate.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/generate.c')
-rwxr-xr-xsrc/generate.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/generate.c b/src/generate.c
index 765c082..09e3e0a 100755
--- a/src/generate.c
+++ b/src/generate.c
@@ -2500,9 +2500,13 @@ Return value:
ULONG u;
MOVE mv;
SCORE s;
+#ifdef DEBUG
MOVE_STACK_MOVE_VALUE_FLAGS mvf;
+#endif
ULONG uHashMoveLoc = (ULONG)-1;
+#ifdef DEBUG
ULONG uColor = pos->uToMove;
+#endif
PRECOMP_KILLERS sKillers[4];
ULONG uCounterMoveIdx = 0;
ULONG uCounterMoveContKey = 0;
@@ -2723,7 +2727,9 @@ Return value:
ASSERT(MOVE_COUNT(ctx, uPly) >= 1);
ASSERT(uHashMoveLoc >= pStack->uBegin[uPly]);
ASSERT(uHashMoveLoc < pStack->uEnd[uPly]);
+#ifdef DEBUG
mvf = pStack->mvf[uHashMoveLoc];
+#endif
pStack->mvf[uHashMoveLoc] = pStack->mvf[pStack->uEnd[uPly] - 1];
#ifdef DEBUG
pStack->mvf[pStack->uEnd[uPly] - 1] = mvf;
@@ -2762,7 +2768,9 @@ Return value:
ULONG u;
MOVE mv;
SCORE s;
+#ifdef DEBUG
MOVE_STACK_MOVE_VALUE_FLAGS mvf;
+#endif
ULONG uHashMoveLoc = (ULONG)-1;
COOR c;
ULONG v;
@@ -2931,7 +2939,9 @@ Return value:
ASSERT(MOVE_COUNT(ctx, uPly) >= 1);
ASSERT(uHashMoveLoc >= pStack->uBegin[uPly]);
ASSERT(uHashMoveLoc < pStack->uEnd[uPly]);
+#ifdef DEBUG
mvf = pStack->mvf[uHashMoveLoc];
+#endif
pStack->mvf[uHashMoveLoc] = pStack->mvf[pStack->uEnd[uPly] - 1];
#ifdef DEBUG
pStack->mvf[pStack->uEnd[uPly] - 1] = mvf;
@@ -3125,7 +3135,10 @@ Return value:
{
register POSITION *pos = &(ctx->sPosition);
ULONG uPly = ctx->uPly;
- ULONG u, uColor;
+ ULONG u;
+#ifdef DEBUG
+ ULONG uColor;
+#endif
MOVE mv;
SCORE s;
@@ -3139,7 +3152,9 @@ Return value:
//
ASSERT(MOVE_COUNT(ctx, uPly) <= MAX_MOVES_PER_PLY);
+#ifdef DEBUG
uColor = pos->uToMove;
+#endif
for (u = pStack->uBegin[uPly];
u < pStack->uEnd[uPly];
u++)