]> git.sesse.net Git - stockfish/commitdiff
Use #ifndef instead of #if !defined
authorhomoSapiensSapiens <reuvenpe2005@gmail.com>
Tue, 23 Jul 2013 13:31:57 +0000 (16:31 +0300)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 24 Jul 2013 17:49:17 +0000 (19:49 +0200)
And #ifdef instead of #if defined

This is more standard form (see for example iostream file).

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
23 files changed:
src/bitboard.cpp
src/bitboard.h
src/bitcount.h
src/book.h
src/endgame.h
src/evaluate.h
src/material.h
src/misc.cpp
src/misc.h
src/movegen.h
src/movepick.h
src/notation.h
src/pawns.h
src/platform.h
src/position.h
src/psqtab.h
src/rkiss.h
src/search.h
src/thread.h
src/timeman.h
src/tt.h
src/types.h
src/ucioption.h

index 3f855c574e6c0e0cc4377820218559f9bbf331e8..39da197646e50e13824c6613773ad3f46a6cdedd 100644 (file)
@@ -83,7 +83,7 @@ namespace {
 /// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
 /// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
 
-#if !defined(USE_BSFQ)
+#ifndef USE_BSFQ
 
 Square lsb(Bitboard b) { return BSFTable[bsf_index(b)]; }
 
@@ -122,7 +122,7 @@ Square msb(Bitboard b) {
   return (Square)(result + MS1BTable[b32]);
 }
 
-#endif // !defined(USE_BSFQ)
+#endif // ifndef USE_BSFQ
 
 
 /// Bitboards::print() prints a bitboard in an easily readable format to the
index eec8342fb61b0e8ebe7443db0238022d1f5140fb..d15d883843048aa4d2f155cc92c2cd0a24bc7ba4 100644 (file)
@@ -18,7 +18,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(BITBOARD_H_INCLUDED)
+#ifndef BITBOARD_H_INCLUDED
 #define BITBOARD_H_INCLUDED
 
 #include "types.h"
@@ -258,7 +258,7 @@ inline Bitboard attacks_bb(Square s, Bitboard occ) {
 /// lsb()/msb() finds the least/most significant bit in a nonzero bitboard.
 /// pop_lsb() finds and clears the least significant bit in a nonzero bitboard.
 
-#if defined(USE_BSFQ)
+#ifdef BSFQ
 
 #  if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
 
@@ -311,7 +311,7 @@ FORCE_INLINE Square pop_lsb(Bitboard* b) {
   return s;
 }
 
-#else // if !defined(USE_BSFQ)
+#else // if defined(USE_BSFQ)
 
 extern Square msb(Bitboard b);
 extern Square lsb(Bitboard b);
@@ -319,4 +319,4 @@ extern Square pop_lsb(Bitboard* b);
 
 #endif
 
-#endif // !defined(BITBOARD_H_INCLUDED)
+#endif // #ifndef BITBOARD_H_INCLUDED
index 2300bc96452cef857a819b7ab73b3ddbe8f2cf3e..ad8df94ab078522066fdfa44da80c931fa732c88 100644 (file)
@@ -18,7 +18,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(BITCOUNT_H_INCLUDED)
+#ifndef BITCOUNT_H_INCLUDED
 #define BITCOUNT_H_INCLUDED
 
 #include <cassert>
@@ -81,7 +81,7 @@ inline int popcount<CNT_32_MAX15>(Bitboard b) {
 template<>
 inline int popcount<CNT_HW_POPCNT>(Bitboard b) {
 
-#if !defined(USE_POPCNT)
+#ifndef USE_POPCNT
 
   assert(false);
   return b != 0; // Avoid 'b not used' warning
@@ -102,4 +102,4 @@ inline int popcount<CNT_HW_POPCNT>(Bitboard b) {
 #endif
 }
 
-#endif // !defined(BITCOUNT_H_INCLUDED)
+#endif // #ifndef BITCOUNT_H_INCLUDED
index ed446636c8a45359489b61c345fe00aeb9b9fec2..4ce74f471fddddfdef74b710e6de15153ac89d93 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(BOOK_H_INCLUDED)
+#ifndef BOOK_H_INCLUDED
 #define BOOK_H_INCLUDED
 
 #include <fstream>
@@ -42,4 +42,4 @@ private:
   std::string fileName;
 };
 
-#endif // !defined(BOOK_H_INCLUDED)
+#endif // #ifndef BOOK_H_INCLUDED
index b560c7989f9d93c72e65995f99ce6bc7ce200498..7f3ce6fba0cb3ddb1296eaf7ab66991201425806 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(ENDGAME_H_INCLUDED)
+#ifndef ENDGAME_H_INCLUDED
 #define ENDGAME_H_INCLUDED
 
 #include <map>
@@ -119,4 +119,4 @@ public:
   { return eg = map(eg).count(key) ? map(eg)[key] : NULL; }
 };
 
-#endif // !defined(ENDGAME_H_INCLUDED)
+#endif // #ifndef ENDGAME_H_INCLUDED
index 8eb396423a989e7fe332afa2545de35683f50954..2234a4a0f9078e3e5abf1230825be03659040b75 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(EVALUATE_H_INCLUDED)
+#ifndef EVALUATE_H_INCLUDED
 #define EVALUATE_H_INCLUDED
 
 #include "types.h"
@@ -32,4 +32,4 @@ extern std::string trace(const Position& pos);
 
 }
 
-#endif // !defined(EVALUATE_H_INCLUDED)
+#endif // #ifndef EVALUATE_H_INCLUDED
index 96fd3f8fe994124b30d28d08486c1b391f456164..cbf6e5550e2b6b1ca55fcd0784ef7074920576cf 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(MATERIAL_H_INCLUDED)
+#ifndef MATERIAL_H_INCLUDED
 #define MATERIAL_H_INCLUDED
 
 #include "endgame.h"
@@ -74,4 +74,4 @@ inline ScaleFactor Entry::scale_factor(const Position& pos, Color c) const {
 
 }
 
-#endif // !defined(MATERIAL_H_INCLUDED)
+#endif // #ifndef MATERIAL_H_INCLUDED
index 16ae0a6b338d5986dea9c03c0232771d4546eb20..0ca56571ee96f723e8b25991ebbc8efbc29a5e47 100644 (file)
@@ -24,7 +24,7 @@
 #include "misc.h"
 #include "thread.h"
 
-#if defined(__hpux)
+#ifdef __hpux
 #    include <sys/pstat.h>
 #endif
 
@@ -173,7 +173,7 @@ void start_logger(bool b) { Logger::start(b); }
 
 int cpu_count() {
 
-#if defined(_WIN32)
+#ifdef _WIN32
   SYSTEM_INFO s;
   GetSystemInfo(&s);
   return s.dwNumberOfProcessors;
@@ -199,7 +199,7 @@ int cpu_count() {
 
 void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) {
 
-#if defined(_WIN32)
+#ifdef _WIN32
   int tm = msec;
 #else
   timespec ts, *tm = &ts;
@@ -216,7 +216,7 @@ void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) {
 /// prefetch() preloads the given address in L1/L2 cache. This is a non
 /// blocking function and do not stalls the CPU waiting for data to be
 /// loaded from memory, that can be quite slow.
-#if defined(NO_PREFETCH)
+#ifdef NO_PREFETCH
 
 void prefetch(char*) {}
 
index c09d2c6b3125453bbb63c14a3427a1018938c9bc..ea1e55f1a43f1ada32cae859d1aac2214fb7eed4 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(MISC_H_INCLUDED)
+#ifndef MISC_H_INCLUDED
 #define MISC_H_INCLUDED
 
 #include <fstream>
@@ -66,4 +66,4 @@ std::ostream& operator<<(std::ostream&, SyncCout);
 #define sync_cout std::cout << io_lock
 #define sync_endl std::endl << io_unlock
 
-#endif // !defined(MISC_H_INCLUDED)
+#endif // #ifndef MISC_H_INCLUDED
index 71e9ca039870d08a6ebb364144c7d122d02a791e..2a4cda90dffef0117e450fdbe1a7491103f30bb8 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(MOVEGEN_H_INCLUDED)
+#ifndef MOVEGEN_H_INCLUDED
 #define MOVEGEN_H_INCLUDED
 
 #include "types.h"
@@ -55,4 +55,4 @@ private:
   ExtMove *cur, *last;
 };
 
-#endif // !defined(MOVEGEN_H_INCLUDED)
+#endif // #ifndef MOVEGEN_H_INCLUDED
index 572025f20e0edb936f8dba3b7df4eb74dc2013cf..c444615f5b9f2e8ab4a0952ff47e3c97bf642079 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined MOVEPICK_H_INCLUDED
+#ifndef MOVEPICK_H_INCLUDED
 #define MOVEPICK_H_INCLUDED
 
 #include <algorithm> // For std::max
@@ -107,4 +107,4 @@ private:
   ExtMove moves[MAX_MOVES];
 };
 
-#endif // !defined(MOVEPICK_H_INCLUDED)
+#endif // #ifndef MOVEPICK_H_INCLUDED
index d757bd402d923a751062de5830ec9b051192f141..3ede26074ac703bab48d2dee6612ab39c4be93be 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(NOTATION_H_INCLUDED)
+#ifndef NOTATION_H_INCLUDED
 #define NOTATION_H_INCLUDED
 
 #include <string>
@@ -32,4 +32,4 @@ const std::string move_to_uci(Move m, bool chess960);
 const std::string move_to_san(Position& pos, Move m);
 std::string pretty_pv(Position& pos, int depth, Value score, int64_t msecs, Move pv[]);
 
-#endif // !defined(NOTATION_H_INCLUDED)
+#endif // #ifndef NOTATION_H_INCLUDED
index 307da51c53fb42a4d66ede8c9af0080b1ad03c27..7292606b8451b95a06716bc65a6157a7668d1971 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(PAWNS_H_INCLUDED)
+#ifndef PAWNS_H_INCLUDED
 #define PAWNS_H_INCLUDED
 
 #include "misc.h"
@@ -75,4 +75,4 @@ Entry* probe(const Position& pos, Table& entries);
 
 }
 
-#endif // !defined(PAWNS_H_INCLUDED)
+#endif // #ifndef PAWNS_H_INCLUDED
index 334a0eecd0a1a914c22460eb5086af000e9b1753..e4b4d2ceaef144b90b2f6a40a159b1b4a7f23f6f 100644 (file)
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(PLATFORM_H_INCLUDED)
+#ifndef PLATFORM_H_INCLUDED
 #define PLATFORM_H_INCLUDED
 
-#if defined(_MSC_VER)
+#ifdef _MSC_VER
 
 // Disable some silly and noisy warning from MSVC compiler
 #pragma warning(disable: 4127) // Conditional expression is constant
@@ -43,7 +43,7 @@ typedef unsigned __int64 uint64_t;
 #  include <unistd.h>  // Used by sysconf(_SC_NPROCESSORS_ONLN)
 #endif
 
-#if !defined(_WIN32) // Linux - Unix
+#ifndef _WIN32 // Linux - Unix
 
 #  include <sys/time.h>
 typedef timeval sys_time_t;
@@ -77,7 +77,7 @@ typedef _timeb sys_time_t;
 inline void system_time(sys_time_t* t) { _ftime(t); }
 inline int64_t time_to_msec(const sys_time_t& t) { return t.time * 1000LL + t.millitm; }
 
-#if !defined(NOMINMAX)
+#ifndef NOMINMAX
 #  define NOMINMAX // disable macros min() and max()
 #endif
 
@@ -110,4 +110,4 @@ inline DWORD* dwWin9xKludge() { static DWORD dw; return &dw; }
 
 #endif
 
-#endif // !defined(PLATFORM_H_INCLUDED)
+#endif // #ifndef PLATFORM_H_INCLUDED
index 5a4c594df8e3d7055f196ed430cd1fd1f9320aeb..512313921458cae7d843214644026f2d7399fe25 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(POSITION_H_INCLUDED)
+#ifndef POSITION_H_INCLUDED
 #define POSITION_H_INCLUDED
 
 #include <cassert>
@@ -414,4 +414,4 @@ inline Thread* Position::this_thread() const {
   return thisThread;
 }
 
-#endif // !defined(POSITION_H_INCLUDED)
+#endif // #ifndef POSITION_H_INCLUDED
index 2dc29b615f9414c7c7b87c9156cea70c34e45615..f45442dabb1d3e8a33ce9ee2352d14e8f00c740b 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(PSQTAB_H_INCLUDED)
+#ifndef PSQTAB_H_INCLUDED
 #define PSQTAB_H_INCLUDED
 
 #include "types.h"
@@ -95,4 +95,4 @@ static const Score PSQT[][SQUARE_NB] = {
 
 #undef S
 
-#endif // !defined(PSQTAB_H_INCLUDED)
+#endif // #ifndef PSQTAB_H_INCLUDED
index 86f0599b6a4e606defb6ee6c0789c4136242e6c2..9564253b91a81301a70fd029163eac470248187c 100644 (file)
@@ -22,7 +22,7 @@
   (at your option) any later version.
 */
 
-#if !defined(RKISS_H_INCLUDED)
+#ifndef RKISS_H_INCLUDED
 #define RKISS_H_INCLUDED
 
 #include "types.h"
@@ -71,4 +71,4 @@ public:
   template<typename T> T rand() { return T(rand64()); }
 };
 
-#endif // !defined(RKISS_H_INCLUDED)
+#endif // #ifndef RKISS_H_INCLUDED
index 37ea9feaefa76fa981d2a4052064b76fa50196fa..e2a136062c689a79695b4c725719f7c9cb562bdc 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(SEARCH_H_INCLUDED)
+#ifndef SEARCH_H_INCLUDED
 #define SEARCH_H_INCLUDED
 
 #include <cstring>
@@ -109,4 +109,4 @@ extern void think();
 
 } // namespace Search
 
-#endif // !defined(SEARCH_H_INCLUDED)
+#endif // #ifndef SEARCH_H_INCLUDED
index 46c40d9bfdab92e3fe3d655f4d50e03629511c3a..4ad08465ff30751ae3f89777ac57ff068d2485d5 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(THREAD_H_INCLUDED)
+#ifndef THREAD_H_INCLUDED
 #define THREAD_H_INCLUDED
 
 #include <vector>
@@ -165,4 +165,4 @@ struct ThreadPool : public std::vector<Thread*> {
 
 extern ThreadPool Threads;
 
-#endif // !defined(THREAD_H_INCLUDED)
+#endif // #ifndef THREAD_H_INCLUDED
index 484513bb18c5265530e5ccae2267e962dffcd6e4..e12b0007f302f37f07cb40ea8c5f6fce07a3f615 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(TIMEMAN_H_INCLUDED)
+#ifndef TIMEMAN_H_INCLUDED
 #define TIMEMAN_H_INCLUDED
 
 /// The TimeManager class computes the optimal time to think depending on the
@@ -36,4 +36,4 @@ private:
   int unstablePVExtraTime;
 };
 
-#endif // !defined(TIMEMAN_H_INCLUDED)
+#endif // #ifndef TIMEMAN_H_INCLUDED
index aee530b05485d6149ec3441e44db51cdcfbf88d7..3113751adb938e868616efe6a8eb78c15e946b43 100644 (file)
--- a/src/tt.h
+++ b/src/tt.h
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(TT_H_INCLUDED)
+#ifndef TT_H_INCLUDED
 #define TT_H_INCLUDED
 
 #include "misc.h"
@@ -115,4 +115,4 @@ inline void TranspositionTable::refresh(const TTEntry* tte) const {
   const_cast<TTEntry*>(tte)->set_generation(generation);
 }
 
-#endif // !defined(TT_H_INCLUDED)
+#endif // #ifndef TT_H_INCLUDED
index 51c05b2ffc12139ac8b6eca184b5b6707791d24a..d27f390a2d970d0eeeeb2acd39b8a527f43874de 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(TYPES_H_INCLUDED)
+#ifndef TYPES_H_INCLUDED
 #define TYPES_H_INCLUDED
 
 /// For Linux and OSX configuration is done automatically using Makefile. To get
@@ -65,7 +65,7 @@
 #  define CACHE_LINE_ALIGNMENT  __attribute__ ((aligned(CACHE_LINE_SIZE)))
 #endif
 
-#if defined(_MSC_VER)
+#ifdef _MSC_VER
 #  define FORCE_INLINE  __forceinline
 #elif defined(__GNUC__)
 #  define FORCE_INLINE  inline __attribute__((always_inline))
 #  define FORCE_INLINE  inline
 #endif
 
-#if defined(USE_POPCNT)
+#ifdef USE_POPCNT
 const bool HasPopCnt = true;
 #else
 const bool HasPopCnt = false;
 #endif
 
-#if defined(IS_64BIT)
+#ifdef IS_64BIT
 const bool Is64Bit = true;
 #else
 const bool Is64Bit = false;
@@ -440,4 +440,4 @@ inline const std::string square_to_string(Square s) {
   return ch;
 }
 
-#endif // !defined(TYPES_H_INCLUDED)
+#endif // #ifndef TYPES_H_INCLUDED
index feafe36a5db934dfb9129676f26441d920cacae3..efdfce6607141be39c4e97950cd5354d6534db8c 100644 (file)
@@ -17,7 +17,7 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#if !defined(UCIOPTION_H_INCLUDED)
+#ifndef UCIOPTION_H_INCLUDED
 #define UCIOPTION_H_INCLUDED
 
 #include <map>
@@ -66,4 +66,4 @@ void loop(const std::string&);
 
 extern UCI::OptionsMap Options;
 
-#endif // !defined(UCIOPTION_H_INCLUDED)
+#endif // #ifndef UCIOPTION_H_INCLUDED