From 6d76699e44f2ed0fb2368ccf0a19ae692a2d4697 Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 3 Sep 2026 17:01:58 -0700 Subject: 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 Claude-Session: https://claude.ai/code/session_014Cmv11sJZqVfanrPh6UnWE --- src/chess.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/chess.h') diff --git a/src/chess.h b/src/chess.h index 8a1185a..7760920 100755 --- a/src/chess.h +++ b/src/chess.h @@ -158,11 +158,11 @@ typedef struct _DLIST_ENTRY // #ifndef OFFSET_OF #define OFFSET_OF(field, type) \ - (ULONG)(&((type *)0)->field) + (size_t)(&((type *)0)->field) #endif #ifndef CONTAINING_STRUCT #define CONTAINING_STRUCT(address, type, field) \ - ((type *)((BYTE *)(address) - (BYTE *)(OFFSET_OF(field, type)))) + ((type *)((BYTE *)(address) - (OFFSET_OF(field, type)))) #endif #define WHITE (1) @@ -1255,7 +1255,7 @@ _assert(CHAR *szFile, ULONG uLine); #endif #ifndef ABS_DIFF -#define ABS_DIFF(a, b) (abs((a) - (b))) +#define ABS_DIFF(a, b) (abs((int)(a) - (int)(b))) #endif #define FILE_DISTANCE(a, b) (ABS_DIFF(FILE((a)), FILE((b)))) @@ -1745,6 +1745,15 @@ SetRootToInitialPosition(void); void SlidePiece(POSITION *pos, COOR cFrom, COOR cTo); +void +SlidePieceWithoutSigs(POSITION *pos, COOR cFrom, COOR cTo); + +void +SlidePawn(POSITION *pos, COOR cFrom, COOR cTo); + +void +SlidePawnWithoutSigs(POSITION *pos, COOR cFrom, COOR cTo); + PIECE LiftPiece(POSITION *pos, COOR cSquare); -- cgit v1.3