]> git.sesse.net Git - stockfish/commitdiff
Run clang-tidy 'modernize'
authorMarco Costalba <mcostalba@gmail.com>
Sun, 13 Aug 2017 12:33:25 +0000 (05:33 -0700)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 13 Aug 2017 12:46:21 +0000 (05:46 -0700)
Some warnings after a run of:

$ clang-tidy-3.8 -checks='modernize-*' *.cpp syzygy/*.cpp -header-filter=.* -- -std=c++11

I have not fixed all suggestions, for instance I still prefer
to declare the type instead of a spread use of 'auto'. I also
perfer good old 'typedef' to the new 'using' form.

I have not fixed some warnings in the last functions of
syzygy code because those are still the original functions
and need to be completely rewritten anyhow.

Thanks to erbsenzaehler for the original idea.

No functional change.

src/endgame.h
src/misc.cpp
src/search.cpp
src/syzygy/tbprobe.cpp
src/thread.h

index 5e181526201da79f4863db34f25b223b0ef94765..3d61207c419c13027efda92cddf29dc147de4bf8 100644 (file)
@@ -85,7 +85,7 @@ template<EndgameCode E, typename T = eg_type<E>>
 struct Endgame : public EndgameBase<T> {
 
   explicit Endgame(Color c) : EndgameBase<T>(c) {}
-  T operator()(const Position&) const;
+  T operator()(const Position&) const override;
 };
 
 
index 42dc0b06d59eb16f3119e4078f8647918fe9598c..d815c9c41fd3dd0ac4463cd1e1a23925a8c1d478 100644 (file)
@@ -63,10 +63,10 @@ struct Tie: public streambuf { // MSVC requires split streambuf for cin and cout
 
   Tie(streambuf* b, streambuf* l) : buf(b), logBuf(l) {}
 
-  int sync() { return logBuf->pubsync(), buf->pubsync(); }
-  int overflow(int c) { return log(buf->sputc((char)c), "<< "); }
-  int underflow() { return buf->sgetc(); }
-  int uflow() { return log(buf->sbumpc(), ">> "); }
+  int sync() override { return logBuf->pubsync(), buf->pubsync(); }
+  int overflow(int c) override { return log(buf->sputc((char)c), "<< "); }
+  int underflow() override { return buf->sgetc(); }
+  int uflow() override { return log(buf->sbumpc(), ">> "); }
 
   streambuf *buf, *logBuf;
 
index e93c5045578193a5e493e1000e34ae8eb7990518..fbcae4601b3d071e1448456b847d1ce1de7b0840 100644 (file)
@@ -253,7 +253,7 @@ void MainThread::search() {
 
   if (rootMoves.empty())
   {
-      rootMoves.push_back(RootMove(MOVE_NONE));
+      rootMoves.emplace_back(MOVE_NONE);
       sync_cout << "info depth 0 score "
                 << UCI::value(rootPos.checkers() ? -VALUE_MATE : VALUE_DRAW)
                 << sync_endl;
index 76d8ec68628eb9995142bdffaa007db9a2fad13d..8b87c250662ef60d013331911f41adafd0fc815e 100644 (file)
@@ -489,8 +489,8 @@ void HashTable::insert(const std::vector<PieceType>& pieces) {
 
     MaxCardinality = std::max((int)pieces.size(), MaxCardinality);
 
-    wdlTable.push_back(WDLEntry(code));
-    dtzTable.push_back(DTZEntry(wdlTable.back()));
+    wdlTable.emplace_back(code);
+    dtzTable.emplace_back(wdlTable.back());
 
     insert(wdlTable.back().key , &wdlTable.back(), &dtzTable.back());
     insert(wdlTable.back().key2, &wdlTable.back(), &dtzTable.back());
index 75fa95b2f30270a944fe63f66c1d4021dbad95fb..8c0a66653e7f516f58f17e12de68d64d4181116e 100644 (file)
@@ -78,7 +78,7 @@ struct MainThread : public Thread {
 
   using Thread::Thread;
 
-  virtual void search();
+  void search() override;
   void check_time();
 
   bool easyMovePlayed, failedLow;