1
0
Fork 0

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>
sf_2.3.1_base
Marco Costalba 2009-03-30 11:55:13 +02:00
parent 659c54582d
commit 683595fee1
11 changed files with 28 additions and 22 deletions

View File

@ -38,7 +38,7 @@ enum Color {
////
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) {
return Color(int(c) ^ 1);

View File

@ -383,7 +383,7 @@ Value EvaluationFunction<KBBKN>::apply(const Position& pos) {
}
template<>
Value EvaluationFunction<KmmKm>::apply(const Position &pos) {
Value EvaluationFunction<KmmKm>::apply(const Position&) {
return Value(0);
}

View File

@ -47,6 +47,8 @@ struct SearchStack;
class MovePicker {
MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
public:
enum MovegenPhase {

View File

@ -121,8 +121,8 @@ namespace {
};
// Pawn storm open file bonuses by file
const int 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 KStormOpenFileBonus[8] = { 45, 45, 30, 0, 0, 0, 0, 0 };
const int16_t QStormOpenFileBonus[8] = { 0, 0, 0, 0, 0, 30, 45, 30 };
// Pawn storm lever bonuses by file
const int StormLeverBonus[8] = { 20, 20, 10, 0, 0, 10, 20, 20 };

View File

@ -35,8 +35,8 @@
static const char PieceChars[] = " pnbrqk";
int piece_type_to_char(PieceType pt, bool upcase) {
return upcase? toupper(PieceChars[pt]) : PieceChars[pt];
char piece_type_to_char(PieceType pt, bool upcase) {
return char(upcase? toupper(PieceChars[pt]) : PieceChars[pt]);
}
PieceType piece_type_from_char(char c) {

View File

@ -104,7 +104,7 @@ inline bool piece_is_ok(Piece pc) {
//// 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);

View File

@ -755,7 +755,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
st->capture = type_of_piece_on(to);
if (st->capture)
do_capture_move(m, st->capture, them, to);
do_capture_move(st->capture, them, to);
// Move the piece
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
/// 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);
@ -1010,7 +1010,7 @@ void Position::do_promotion_move(Move m) {
st->capture = type_of_piece_on(to);
if (st->capture)
do_capture_move(m, st->capture, them, to);
do_capture_move(st->capture, them, to);
// Remove pawn
clear_bit(&(byColorBB[us]), from);

View File

@ -27,6 +27,10 @@
// Forcing value to bool 'true' or 'false' (performance warning)
#pragma warning(disable: 4800)
// Conditional expression is constant
#pragma warning(disable: 4127)
#endif
////
@ -305,7 +309,7 @@ private:
void allow_ooo(Color c);
// 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_promotion_move(Move m);
void do_ep_move(Move m);

View File

@ -258,7 +258,7 @@ namespace {
Depth depth, int ply, int threadID);
void sp_search(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 sp_update_pv(SearchStack *pss, SearchStack ss[], int ply);
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,
// an instant draw, maximum ply reached, etc.
init_node(pos, ss, ply, threadID);
init_node(ss, ply, threadID);
// After init_node() that calls poll()
if (AbortSearch || thread_should_stop(threadID))
@ -1155,7 +1155,7 @@ namespace {
// Initialize, and make an early exit in case of an aborted search,
// an instant draw, maximum ply reached, etc.
init_node(pos, ss, ply, threadID);
init_node(ss, ply, threadID);
// After init_node() that calls poll()
if (AbortSearch || thread_should_stop(threadID))
@ -1424,7 +1424,7 @@ namespace {
// Initialize, and make an early exit in case of an aborted search,
// an instant draw, maximum ply reached, etc.
init_node(pos, ss, ply, threadID);
init_node(ss, ply, threadID);
// After init_node() that calls poll()
if (AbortSearch || thread_should_stop(threadID))
@ -1451,6 +1451,7 @@ namespace {
EvalInfo ei;
Value staticValue;
bool isCheck = pos.is_check();
ei.futilityMargin = Value(0); // Manually initialize futilityMargin
if (isCheck)
staticValue = -VALUE_INFINITE;
@ -1462,7 +1463,6 @@ namespace {
assert(ei.futilityMargin == Value(0));
staticValue = tte->value();
ei.futilityMargin = Value(0); // manually initialize futilityMargin
}
else
staticValue = evaluate(pos, ei, threadID);
@ -2025,7 +2025,7 @@ namespace {
// NodesBetweenPolls nodes, init_node() also calls poll(), which polls
// 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(threadID >= 0 && threadID < ActiveThreads);

View File

@ -163,16 +163,16 @@ inline File file_from_char(char c) {
return File(c - 'a') + FILE_A;
}
inline int file_to_char(File f) {
return int(f - FILE_A) + 'a';
inline char file_to_char(File f) {
return char(f - FILE_A) + 'a';
}
inline Rank rank_from_char(char c) {
return Rank(c - '1') + RANK_1;
}
inline int rank_to_char(Rank r) {
return int(r - RANK_1) + '1';
inline char rank_to_char(Rank r) {
return char(r - RANK_1) + '1';
}
inline Square square_from_string(const std::string& str) {

View File

@ -9,7 +9,7 @@
#include <time.h>
#include "dos.h"
int gettimeofday(struct timeval* tp, struct timezone* tzp)
int gettimeofday(struct timeval* tp, struct timezone*)
{
SYSTEMTIME systime;