]> git.sesse.net Git - stockfish/commitdiff
Explicitly annotate a few variables
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 11 Sep 2022 19:28:12 +0000 (21:28 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 17 Sep 2022 07:05:35 +0000 (09:05 +0200)
as [[maybe_unused]], avoiding the (void)foo trick.

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

No functional change

src/misc.cpp
src/movepick.cpp

index 41c59b3fd888066fc6017318b0c274c0822ebbf3..d19cd840bbaea481330d77c9d27ff86efb60cd7a 100644 (file)
@@ -378,10 +378,9 @@ void std_aligned_free(void* ptr) {
 
 #if defined(_WIN32)
 
-static void* aligned_large_pages_alloc_windows(size_t allocSize) {
+static void* aligned_large_pages_alloc_windows([[maybe_unused]] size_t allocSize) {
 
   #if !defined(_WIN64)
-    (void)allocSize; // suppress unused-parameter compiler warning
     return nullptr;
   #else
 
@@ -626,8 +625,7 @@ string argv0;            // path+name of the executable binary, as given by argv
 string binaryDirectory;  // path of the executable directory
 string workingDirectory; // path of the working directory
 
-void init(int argc, char* argv[]) {
-    (void)argc;
+void init([[maybe_unused]] int argc, char* argv[]) {
     string pathSeparator;
 
     // extract the path+name of the executable binary
index 60d041ab9c72837326c872491383abb89cffd895..d8d0612a585e69ec98cb00ef43e220915f2b78ae 100644 (file)
@@ -106,7 +106,7 @@ void MovePicker::score() {
 
   static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
 
-  Bitboard threatened, threatenedByPawn, threatenedByMinor, threatenedByRook;
+  [[maybe_unused]] Bitboard threatened, threatenedByPawn, threatenedByMinor, threatenedByRook;
   if constexpr (Type == QUIETS)
   {
       Color us = pos.side_to_move();
@@ -122,14 +122,6 @@ void MovePicker::score() {
                   | (pos.pieces(us, ROOK)  & threatenedByMinor)
                   | (pos.pieces(us, KNIGHT, BISHOP) & threatenedByPawn);
   }
-  else
-  {
-      // Silence unused variable warnings
-      (void) threatened;
-      (void) threatenedByPawn;
-      (void) threatenedByMinor;
-      (void) threatenedByRook;
-  }
 
   for (auto& m : *this)
       if constexpr (Type == CAPTURES)