mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 11:39:15 +00:00
Silence a bunch of warnings under MSVC /W4
Still some remain, but are really the silly ones. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
659c54582d
commit
683595fee1
11 changed files with 28 additions and 22 deletions
|
@ -38,7 +38,7 @@ enum Color {
|
||||||
////
|
////
|
||||||
|
|
||||||
inline Color operator+ (Color c, int i) { return Color(int(c) + i); }
|
inline Color operator+ (Color c, int i) { return Color(int(c) + i); }
|
||||||
inline void operator++ (Color &c, int i) { c = Color(int(c) + 1); }
|
inline void operator++ (Color &c, int) { c = Color(int(c) + 1); }
|
||||||
|
|
||||||
inline Color opposite_color(Color c) {
|
inline Color opposite_color(Color c) {
|
||||||
return Color(int(c) ^ 1);
|
return Color(int(c) ^ 1);
|
||||||
|
|
|
@ -383,7 +383,7 @@ Value EvaluationFunction<KBBKN>::apply(const Position& pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Value EvaluationFunction<KmmKm>::apply(const Position &pos) {
|
Value EvaluationFunction<KmmKm>::apply(const Position&) {
|
||||||
return Value(0);
|
return Value(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,8 @@ struct SearchStack;
|
||||||
|
|
||||||
class MovePicker {
|
class MovePicker {
|
||||||
|
|
||||||
|
MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum MovegenPhase {
|
enum MovegenPhase {
|
||||||
|
|
|
@ -121,8 +121,8 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pawn storm open file bonuses by file
|
// Pawn storm open file bonuses by file
|
||||||
const int KStormOpenFileBonus[8] = { 45, 45, 30, 0, 0, 0, 0, 0 };
|
const int16_t KStormOpenFileBonus[8] = { 45, 45, 30, 0, 0, 0, 0, 0 };
|
||||||
const int QStormOpenFileBonus[8] = { 0, 0, 0, 0, 0, 30, 45, 30 };
|
const int16_t QStormOpenFileBonus[8] = { 0, 0, 0, 0, 0, 30, 45, 30 };
|
||||||
|
|
||||||
// Pawn storm lever bonuses by file
|
// Pawn storm lever bonuses by file
|
||||||
const int StormLeverBonus[8] = { 20, 20, 10, 0, 0, 10, 20, 20 };
|
const int StormLeverBonus[8] = { 20, 20, 10, 0, 0, 10, 20, 20 };
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
static const char PieceChars[] = " pnbrqk";
|
static const char PieceChars[] = " pnbrqk";
|
||||||
|
|
||||||
int piece_type_to_char(PieceType pt, bool upcase) {
|
char piece_type_to_char(PieceType pt, bool upcase) {
|
||||||
return upcase? toupper(PieceChars[pt]) : PieceChars[pt];
|
return char(upcase? toupper(PieceChars[pt]) : PieceChars[pt]);
|
||||||
}
|
}
|
||||||
|
|
||||||
PieceType piece_type_from_char(char c) {
|
PieceType piece_type_from_char(char c) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ inline bool piece_is_ok(Piece pc) {
|
||||||
//// Prototypes
|
//// Prototypes
|
||||||
////
|
////
|
||||||
|
|
||||||
extern int piece_type_to_char(PieceType pt, bool upcase = false);
|
extern char piece_type_to_char(PieceType pt, bool upcase = false);
|
||||||
extern PieceType piece_type_from_char(char c);
|
extern PieceType piece_type_from_char(char c);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -755,7 +755,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
||||||
st->capture = type_of_piece_on(to);
|
st->capture = type_of_piece_on(to);
|
||||||
|
|
||||||
if (st->capture)
|
if (st->capture)
|
||||||
do_capture_move(m, st->capture, them, to);
|
do_capture_move(st->capture, them, to);
|
||||||
|
|
||||||
// Move the piece
|
// Move the piece
|
||||||
clear_bit(&(byColorBB[us]), from);
|
clear_bit(&(byColorBB[us]), from);
|
||||||
|
@ -848,7 +848,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
||||||
/// Position::do_capture_move() is a private method used to update captured
|
/// Position::do_capture_move() is a private method used to update captured
|
||||||
/// piece info. It is called from the main Position::do_move function.
|
/// piece info. It is called from the main Position::do_move function.
|
||||||
|
|
||||||
void Position::do_capture_move(Move m, PieceType capture, Color them, Square to) {
|
void Position::do_capture_move(PieceType capture, Color them, Square to) {
|
||||||
|
|
||||||
assert(capture != KING);
|
assert(capture != KING);
|
||||||
|
|
||||||
|
@ -1010,7 +1010,7 @@ void Position::do_promotion_move(Move m) {
|
||||||
st->capture = type_of_piece_on(to);
|
st->capture = type_of_piece_on(to);
|
||||||
|
|
||||||
if (st->capture)
|
if (st->capture)
|
||||||
do_capture_move(m, st->capture, them, to);
|
do_capture_move(st->capture, them, to);
|
||||||
|
|
||||||
// Remove pawn
|
// Remove pawn
|
||||||
clear_bit(&(byColorBB[us]), from);
|
clear_bit(&(byColorBB[us]), from);
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
// Forcing value to bool 'true' or 'false' (performance warning)
|
// Forcing value to bool 'true' or 'false' (performance warning)
|
||||||
#pragma warning(disable: 4800)
|
#pragma warning(disable: 4800)
|
||||||
|
|
||||||
|
// Conditional expression is constant
|
||||||
|
#pragma warning(disable: 4127)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////
|
////
|
||||||
|
@ -305,7 +309,7 @@ private:
|
||||||
void allow_ooo(Color c);
|
void allow_ooo(Color c);
|
||||||
|
|
||||||
// Helper functions for doing and undoing moves
|
// Helper functions for doing and undoing moves
|
||||||
void do_capture_move(Move m, PieceType capture, Color them, Square to);
|
void do_capture_move(PieceType capture, Color them, Square to);
|
||||||
void do_castle_move(Move m);
|
void do_castle_move(Move m);
|
||||||
void do_promotion_move(Move m);
|
void do_promotion_move(Move m);
|
||||||
void do_ep_move(Move m);
|
void do_ep_move(Move m);
|
||||||
|
|
|
@ -258,7 +258,7 @@ namespace {
|
||||||
Depth depth, int ply, int threadID);
|
Depth depth, int ply, int threadID);
|
||||||
void sp_search(SplitPoint *sp, int threadID);
|
void sp_search(SplitPoint *sp, int threadID);
|
||||||
void sp_search_pv(SplitPoint *sp, int threadID);
|
void sp_search_pv(SplitPoint *sp, int threadID);
|
||||||
void init_node(const Position &pos, SearchStack ss[], int ply, int threadID);
|
void init_node(SearchStack ss[], int ply, int threadID);
|
||||||
void update_pv(SearchStack ss[], int ply);
|
void update_pv(SearchStack ss[], int ply);
|
||||||
void sp_update_pv(SearchStack *pss, SearchStack ss[], int ply);
|
void sp_update_pv(SearchStack *pss, SearchStack ss[], int ply);
|
||||||
bool connected_moves(const Position &pos, Move m1, Move m2);
|
bool connected_moves(const Position &pos, Move m1, Move m2);
|
||||||
|
@ -959,7 +959,7 @@ namespace {
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
// an instant draw, maximum ply reached, etc.
|
// an instant draw, maximum ply reached, etc.
|
||||||
init_node(pos, ss, ply, threadID);
|
init_node(ss, ply, threadID);
|
||||||
|
|
||||||
// After init_node() that calls poll()
|
// After init_node() that calls poll()
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
|
@ -1155,7 +1155,7 @@ namespace {
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
// an instant draw, maximum ply reached, etc.
|
// an instant draw, maximum ply reached, etc.
|
||||||
init_node(pos, ss, ply, threadID);
|
init_node(ss, ply, threadID);
|
||||||
|
|
||||||
// After init_node() that calls poll()
|
// After init_node() that calls poll()
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
|
@ -1424,7 +1424,7 @@ namespace {
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
// an instant draw, maximum ply reached, etc.
|
// an instant draw, maximum ply reached, etc.
|
||||||
init_node(pos, ss, ply, threadID);
|
init_node(ss, ply, threadID);
|
||||||
|
|
||||||
// After init_node() that calls poll()
|
// After init_node() that calls poll()
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
|
@ -1451,6 +1451,7 @@ namespace {
|
||||||
EvalInfo ei;
|
EvalInfo ei;
|
||||||
Value staticValue;
|
Value staticValue;
|
||||||
bool isCheck = pos.is_check();
|
bool isCheck = pos.is_check();
|
||||||
|
ei.futilityMargin = Value(0); // Manually initialize futilityMargin
|
||||||
|
|
||||||
if (isCheck)
|
if (isCheck)
|
||||||
staticValue = -VALUE_INFINITE;
|
staticValue = -VALUE_INFINITE;
|
||||||
|
@ -1462,7 +1463,6 @@ namespace {
|
||||||
assert(ei.futilityMargin == Value(0));
|
assert(ei.futilityMargin == Value(0));
|
||||||
|
|
||||||
staticValue = tte->value();
|
staticValue = tte->value();
|
||||||
ei.futilityMargin = Value(0); // manually initialize futilityMargin
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
staticValue = evaluate(pos, ei, threadID);
|
staticValue = evaluate(pos, ei, threadID);
|
||||||
|
@ -2025,7 +2025,7 @@ namespace {
|
||||||
// NodesBetweenPolls nodes, init_node() also calls poll(), which polls
|
// NodesBetweenPolls nodes, init_node() also calls poll(), which polls
|
||||||
// for user input and checks whether it is time to stop the search.
|
// for user input and checks whether it is time to stop the search.
|
||||||
|
|
||||||
void init_node(const Position &pos, SearchStack ss[], int ply, int threadID) {
|
void init_node(SearchStack ss[], int ply, int threadID) {
|
||||||
assert(ply >= 0 && ply < PLY_MAX);
|
assert(ply >= 0 && ply < PLY_MAX);
|
||||||
assert(threadID >= 0 && threadID < ActiveThreads);
|
assert(threadID >= 0 && threadID < ActiveThreads);
|
||||||
|
|
||||||
|
|
|
@ -163,16 +163,16 @@ inline File file_from_char(char c) {
|
||||||
return File(c - 'a') + FILE_A;
|
return File(c - 'a') + FILE_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int file_to_char(File f) {
|
inline char file_to_char(File f) {
|
||||||
return int(f - FILE_A) + 'a';
|
return char(f - FILE_A) + 'a';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Rank rank_from_char(char c) {
|
inline Rank rank_from_char(char c) {
|
||||||
return Rank(c - '1') + RANK_1;
|
return Rank(c - '1') + RANK_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int rank_to_char(Rank r) {
|
inline char rank_to_char(Rank r) {
|
||||||
return int(r - RANK_1) + '1';
|
return char(r - RANK_1) + '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Square square_from_string(const std::string& str) {
|
inline Square square_from_string(const std::string& str) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "dos.h"
|
#include "dos.h"
|
||||||
|
|
||||||
int gettimeofday(struct timeval* tp, struct timezone* tzp)
|
int gettimeofday(struct timeval* tp, struct timezone*)
|
||||||
{
|
{
|
||||||
SYSTEMTIME systime;
|
SYSTEMTIME systime;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue