Silence "may be used uninitialized" GCC 15 warning

closes https://github.com/official-stockfish/Stockfish/pull/6083

No functional change
This commit is contained in:
Disservin
2025-05-22 18:41:53 +02:00
committed by Joost VandeVondele
parent 4f021cab3b
commit c13c1d2c30

View File

@@ -33,12 +33,16 @@
namespace Stockfish::Eval::NNUE { namespace Stockfish::Eval::NNUE {
#if defined(__GNUC__) && !defined(__clang__) #if defined(__GNUC__) && !defined(__clang__)
#define sf_assume(cond) \ #if __GNUC__ >= 13
do \ #define sf_assume(cond) __attribute__((assume(cond)))
{ \ #else
if (!(cond)) \ #define sf_assume(cond) \
__builtin_unreachable(); \ do \
} while (0) { \
if (!(cond)) \
__builtin_unreachable(); \
} while (0)
#endif
#else #else
// do nothing for other compilers // do nothing for other compilers
#define sf_assume(cond) #define sf_assume(cond)