From 9b79b75c9b728cf52b00793c4283d630a20e74b8 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Sun, 27 Apr 2025 19:17:52 +0300 Subject: [PATCH] Enforce minimum compiler versions gcc 9.3 clang 10 using unsupported compiler versions will generate an error, older version might miscompile SF CI: improves output on failed bench output closes https://github.com/official-stockfish/Stockfish/pull/6032 No functional change --- src/types.h | 6 ++++++ tests/signature.sh | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/types.h b/src/types.h index 6c797580..5d767215 100644 --- a/src/types.h +++ b/src/types.h @@ -57,11 +57,17 @@ // _WIN32 Building on Windows (any) // _WIN64 Building on Windows 64 bit +// Enforce minimum GCC version #if defined(__GNUC__) && !defined(__clang__) \ && (__GNUC__ < 9 || (__GNUC__ == 9 && __GNUC_MINOR__ < 3)) #error "Stockfish requires GCC 9.3 or later for correct compilation" #endif +// Enforce minimum Clang version +#if defined(__clang__) && (__clang_major__ < 10) + #error "Stockfish requires Clang 10.0 or later for correct compilation" +#endif + #define ASSERT_ALIGNED(ptr, alignment) assert(reinterpret_cast(ptr) % alignment == 0) #if defined(_WIN64) && defined(_MSC_VER) // No Makefile used diff --git a/tests/signature.sh b/tests/signature.sh index 06bd1892..0f6dd758 100755 --- a/tests/signature.sh +++ b/tests/signature.sh @@ -2,16 +2,26 @@ # obtain and optionally verify Bench / signature # if no reference is given, the output is deliberately limited to just the signature +STDOUT_FILE=$(mktemp) +STDERR_FILE=$(mktemp) + error() { echo "running bench for signature failed on line $1" + echo "===== STDOUT =====" + cat "$STDOUT_FILE" + echo "===== STDERR =====" + cat "$STDERR_FILE" + rm -f "$STDOUT_FILE" "$STDERR_FILE" exit 1 } trap 'error ${LINENO}' ERR # obtain +eval "$WINE_PATH ./stockfish bench" > "$STDOUT_FILE" 2> "$STDERR_FILE" || error ${LINENO} +signature=$(grep "Nodes searched : " "$STDERR_FILE" | awk '{print $4}') -signature=`eval "$WINE_PATH ./stockfish bench 2>&1" | grep "Nodes searched : " | awk '{print $4}'` +rm -f "$STDOUT_FILE" "$STDERR_FILE" if [ $# -gt 0 ]; then # compare to given reference @@ -28,4 +38,4 @@ if [ $# -gt 0 ]; then else # just report signature echo $signature -fi +fi \ No newline at end of file