]> git.sesse.net Git - stockfish/commitdiff
Silence a bunch of warnings under MSVC /W4
authorMarco Costalba <mcostalba@gmail.com>
Mon, 30 Mar 2009 09:55:13 +0000 (11:55 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 31 Mar 2009 19:49:56 +0000 (20:49 +0100)
Still some remain, but are really the silly ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/color.h
src/endgame.cpp
src/movepick.h
src/pawns.cpp
src/piece.cpp
src/piece.h
src/position.cpp
src/position.h
src/search.cpp
src/square.h
src/timeoday.cpp

index 872c7b79548dce4524e1b35bfb49cf678356dbc8..30d86d6baf222284e266fd847570c78e58000d39 100644 (file)
@@ -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) {
   return Color(int(c) ^ 1);
 
 inline Color opposite_color(Color c) {
   return Color(int(c) ^ 1);
index f6e4fd3f7adfec53cff96a13944c3fa5721296b9..f82beef608e2a1772d0ce472847c62754edcead6 100644 (file)
@@ -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);
 }
 
index c2619be8baa03602703155e79bb0911dadc16a5c..a5403e096a834d2d9538ae29827109d2d1d828f8 100644 (file)
@@ -47,6 +47,8 @@ struct SearchStack;
 
 class MovePicker {
 
 
 class MovePicker {
 
+  MovePicker& operator=(const MovePicker&); // Silence a warning under MSVC
+
 public:
 
   enum MovegenPhase {
 public:
 
   enum MovegenPhase {
index b9d112f08c5e95772f0bf70437801df48a4daa5e..f06d9f12a1d2a39525bc05184fd511e737c68aa1 100644 (file)
@@ -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 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 };
 
   // Pawn storm lever bonuses by file
   const int StormLeverBonus[8] = { 20, 20, 10, 0, 0, 10, 20, 20 };
index 382ed6456312604c73e2ceea1f9ad40b37c9776e..40babba695165c8ac7630f1e9b0c0222746308ea 100644 (file)
@@ -35,8 +35,8 @@
 
 static const char PieceChars[] = " pnbrqk";
 
 
 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) {
 }
 
 PieceType piece_type_from_char(char c) {
index cf23c0288c2e79dc25bf6cdc6da720f858011532..5e1e58c6b64d571817504c767f8ef16d72cca988 100644 (file)
@@ -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);
 
 
index 591d48fbb41b3254bf8cef4c6a63edcebe91c94a..1081e1da9e723e1e4834fa23ce0f8437f8b4c09c 100644 (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)
     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);
 
     // 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.
 
 /// 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);
 
 
     assert(capture != KING);
 
@@ -1010,7 +1010,7 @@ void Position::do_promotion_move(Move m) {
   st->capture = type_of_piece_on(to);
 
   if (st->capture)
   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);
 
   // Remove pawn
   clear_bit(&(byColorBB[us]), from);
index e5b5f5aa4a85dd7a2aa2c26222d8c6f2822b477b..d2b37478e4ce681714fc11b654986da82a016209 100644 (file)
 // Forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning(disable: 4800)
 
 // Forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning(disable: 4800)
 
+// Conditional expression is constant
+#pragma warning(disable: 4127)
+
+
 #endif
 
 ////
 #endif
 
 ////
@@ -305,7 +309,7 @@ private:
   void allow_ooo(Color c);
 
   // Helper functions for doing and undoing moves
   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);
   void do_castle_move(Move m);
   void do_promotion_move(Move m);
   void do_ep_move(Move m);
index 434587a87d5c6e40c627ca3a54edfbad779a1f0d..806a9be135e40237c1865987258b008f48efe19a 100644 (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);
                 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);
   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.
 
     // 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))
 
     // 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.
 
     // 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))
 
     // 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.
 
     // 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))
 
     // 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();
     EvalInfo ei;
     Value staticValue;
     bool isCheck = pos.is_check();
+    ei.futilityMargin = Value(0); // Manually initialize futilityMargin
 
     if (isCheck)
         staticValue = -VALUE_INFINITE;
 
     if (isCheck)
         staticValue = -VALUE_INFINITE;
@@ -1462,7 +1463,6 @@ namespace {
         assert(ei.futilityMargin == Value(0));
 
         staticValue = tte->value();
         assert(ei.futilityMargin == Value(0));
 
         staticValue = tte->value();
-        ei.futilityMargin = Value(0); // manually initialize futilityMargin
     }
     else
         staticValue = evaluate(pos, ei, threadID);
     }
     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.
 
   // 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);
 
     assert(ply >= 0 && ply < PLY_MAX);
     assert(threadID >= 0 && threadID < ActiveThreads);
 
index e8c693276b051f5a082a58e045269bfe542ac95d..4f024c961df33b8c3c40caed7617b1b14196ccf9 100644 (file)
@@ -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) {
-  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 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) {
 }
 
 inline Square square_from_string(const std::string& str) {
index ed1a2a907bc2bbf26f247f1d65776b892d1af7d0..6909c2dc26208700e8883b3c8797d5b06971d928 100644 (file)
@@ -9,7 +9,7 @@
 #include <time.h>
 #include "dos.h"
 
 #include <time.h>
 #include "dos.h"
 
-int gettimeofday(struct timeval* tp, struct timezone* tzp)
+int gettimeofday(struct timeval* tp, struct timezone*)
 {
     SYSTEMTIME systime;
 
 {
     SYSTEMTIME systime;