From d7a95893a115a51e9e8496b83caf3e189c632b8e Mon Sep 17 00:00:00 2001 From: enz Date: Fri, 3 Oct 2008 21:09:03 +0000 Subject: [PATCH] Don't use UNIX compilation macro anymore git-svn-id: svn://svn.code.sf.net/p/fuego/code/trunk@569 2e953b5c-c64d-0410-be54-f773e93e544c --- build/gmake/fuegomain/Makefile | 2 +- build/gmake/fuegotest/Makefile | 2 +- build/gmake/go/Makefile | 2 +- build/gmake/gouct/Makefile | 2 +- build/gmake/gtpengine/Makefile | 2 +- build/gmake/simpleplayers/Makefile | 2 +- build/gmake/smartgame/Makefile | 2 +- build/gmake/unittestmain/Makefile | 2 +- fuegomain/Makefile.am | 2 +- fuegotest/Makefile.am | 2 +- go/Makefile.am | 2 +- gouct/Makefile.am | 2 +- simpleplayers/Makefile.am | 2 +- smartgame/Makefile.am | 2 +- smartgame/SgDebug.cpp | 6 +++--- smartgame/SgDebug.h | 2 +- smartgame/SgSystem.h | 23 +++-------------------- smartgame/SgTime.cpp | 10 ---------- smartgame/test/SgSystemTest.cpp | 5 ----- unittestmain/Makefile.am | 2 +- 20 files changed, 22 insertions(+), 54 deletions(-) diff --git a/build/gmake/fuegomain/Makefile b/build/gmake/fuegomain/Makefile index 1a252d26..c52a82f8 100644 --- a/build/gmake/fuegomain/Makefile +++ b/build/gmake/fuegomain/Makefile @@ -11,7 +11,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -DVERSION=\"$(FUEGO_VERSION)\" -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame +PROJ_CXXFLAGS = -DVERSION=\"$(FUEGO_VERSION)\" -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/fuegotest/Makefile b/build/gmake/fuegotest/Makefile index 81ddb884..89be3d10 100644 --- a/build/gmake/fuegotest/Makefile +++ b/build/gmake/fuegotest/Makefile @@ -11,7 +11,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -DVERSION=\"$(FUEGO_VERSION)\" -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame -I../../../simpleplayers +PROJ_CXXFLAGS = -DVERSION=\"$(FUEGO_VERSION)\" -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame -I../../../simpleplayers PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/go/Makefile b/build/gmake/go/Makefile index c19445c3..24f0656b 100644 --- a/build/gmake/go/Makefile +++ b/build/gmake/go/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -I../../../gtpengine -I../../../smartgame +PROJ_CXXFLAGS = -I../../../gtpengine -I../../../smartgame PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/gouct/Makefile b/build/gmake/gouct/Makefile index 29efb2b8..93f8a7d2 100644 --- a/build/gmake/gouct/Makefile +++ b/build/gmake/gouct/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -I../../../go -I../../../gtpengine -I../../../smartgame +PROJ_CXXFLAGS = -I../../../go -I../../../gtpengine -I../../../smartgame PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/gtpengine/Makefile b/build/gmake/gtpengine/Makefile index 16b91cde..a51d8a6a 100644 --- a/build/gmake/gtpengine/Makefile +++ b/build/gmake/gtpengine/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 +PROJ_CXXFLAGS = PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/simpleplayers/Makefile b/build/gmake/simpleplayers/Makefile index 55cd589d..1903fa4e 100644 --- a/build/gmake/simpleplayers/Makefile +++ b/build/gmake/simpleplayers/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -I../../../go -I../../../gtpengine -I../../../smartgame +PROJ_CXXFLAGS = -I../../../go -I../../../gtpengine -I../../../smartgame PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/smartgame/Makefile b/build/gmake/smartgame/Makefile index e35afc14..9cb802a8 100644 --- a/build/gmake/smartgame/Makefile +++ b/build/gmake/smartgame/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -I../../../gtpengine +PROJ_CXXFLAGS = -I../../../gtpengine PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/build/gmake/unittestmain/Makefile b/build/gmake/unittestmain/Makefile index f46d1153..4d65247a 100644 --- a/build/gmake/unittestmain/Makefile +++ b/build/gmake/unittestmain/Makefile @@ -9,7 +9,7 @@ REL_OBJDIR = ../build/obj/$(NAME)/release DBG_BINDIR = ../build/debug REL_BINDIR = ../build/release -PROJ_CXXFLAGS = -DUNIX=1 -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame +PROJ_CXXFLAGS = -I../../../go -I../../../gouct -I../../../gtpengine -I../../../smartgame PROJ_DBG_CXXFLAGS = $(PROJ_CXXFLAGS) PROJ_REL_CXXFLAGS = $(PROJ_CXXFLAGS) diff --git a/fuegomain/Makefile.am b/fuegomain/Makefile.am index b1d77de6..44d2bc5c 100644 --- a/fuegomain/Makefile.am +++ b/fuegomain/Makefile.am @@ -24,7 +24,7 @@ fuego_DEPENDENCIES = \ ../gtpengine/libfuego_gtpengine.a fuego_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame \ -I@top_srcdir@/go \ diff --git a/fuegotest/Makefile.am b/fuegotest/Makefile.am index f6133dcd..c30d1c6d 100644 --- a/fuegotest/Makefile.am +++ b/fuegotest/Makefile.am @@ -24,7 +24,7 @@ fuego_test_DEPENDENCIES = \ ../gtpengine/libfuego_gtpengine.a fuego_test_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame \ -I@top_srcdir@/go \ diff --git a/go/Makefile.am b/go/Makefile.am index 7e17051d..42b77292 100644 --- a/go/Makefile.am +++ b/go/Makefile.am @@ -83,7 +83,7 @@ GoStaticSafetySolver.h \ GoTimeControl.h libfuego_go_a_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame diff --git a/gouct/Makefile.am b/gouct/Makefile.am index af528468..754f44ca 100644 --- a/gouct/Makefile.am +++ b/gouct/Makefile.am @@ -32,7 +32,7 @@ GoUctSearch.h \ GoUctUtil.h libfuego_gouct_a_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame \ -I@top_srcdir@/go diff --git a/simpleplayers/Makefile.am b/simpleplayers/Makefile.am index a1d202dc..1d1c6f09 100644 --- a/simpleplayers/Makefile.am +++ b/simpleplayers/Makefile.am @@ -33,7 +33,7 @@ SpSimplePlayer.h \ SpUtil.h libfuego_simpleplayers_a_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame \ -I@top_srcdir@/go diff --git a/smartgame/Makefile.am b/smartgame/Makefile.am index c8401695..8b2b5b07 100644 --- a/smartgame/Makefile.am +++ b/smartgame/Makefile.am @@ -112,7 +112,7 @@ SgUtil.h \ SgWrite.h libfuego_smartgame_a_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine DISTCLEANFILES = *~ diff --git a/smartgame/SgDebug.cpp b/smartgame/SgDebug.cpp index 51b38266..50cb9a70 100644 --- a/smartgame/SgDebug.cpp +++ b/smartgame/SgDebug.cpp @@ -23,10 +23,10 @@ static ofstream s_nullStream; static auto_ptr s_fileStream; -#if UNIX -#define textoutputstream cerr -#else +#if MAC #define textoutputstream cout +#else +#define textoutputstream cerr #endif ostream* g_debugStrPtr(&textoutputstream); diff --git a/smartgame/SgDebug.h b/smartgame/SgDebug.h index 28e8ee7d..3705a030 100644 --- a/smartgame/SgDebug.h +++ b/smartgame/SgDebug.h @@ -33,7 +33,7 @@ void SgDebugToFile(const char* filename); void SgDebugToNull(); /** Set logging stream to console window. - Uses std::cerr if UNIX is defined, std::cout otherwise. + @todo: Bad function name, uses std::cerr on Unix and std::cout on MAC */ void SgDebugToWindow(); diff --git a/smartgame/SgSystem.h b/smartgame/SgSystem.h index 78ebe64c..cf5dca9d 100644 --- a/smartgame/SgSystem.h +++ b/smartgame/SgSystem.h @@ -19,22 +19,6 @@ //---------------------------------------------------------------------------- -// Check which OS we use. Some stuff such as I/O, UI or profiling depends -// on this if one of the symbols is already predefined by a compile switch -// or by a previous header file, then leave it as it is. - -#ifdef MAC - #define UNIX 0 -#else - #ifdef UNIX - #define MAC 0 - #else - #error "no OS defined" - #endif -#endif - -//---------------------------------------------------------------------------- - /** Avoid compiler warnings for unused variables. This function is more portable than using a \#pragma directive. */ @@ -75,7 +59,9 @@ inline void SG_UNUSED(const T&) //---------------------------------------------------------------------------- -#if UNIX +#if MAC +#define OTHER_BYTE_ORDER 0 +#else #include #if (BYTE_ORDER == BIG_ENDIAN) #define OTHER_BYTE_ORDER 0 @@ -83,9 +69,6 @@ inline void SG_UNUSED(const T&) #define OTHER_BYTE_ORDER 1 #endif #endif -#if MAC -#define OTHER_BYTE_ORDER 0 -#endif //---------------------------------------------------------------------------- diff --git a/smartgame/SgTime.cpp b/smartgame/SgTime.cpp index 6fdcfc47..939f6cdd 100644 --- a/smartgame/SgTime.cpp +++ b/smartgame/SgTime.cpp @@ -13,12 +13,10 @@ #include #include #include -#if UNIX #include #include #include #include -#endif #include "SgException.h" using namespace std; @@ -37,16 +35,12 @@ clock_t g_ticksPerMinute; void Init() { -#if UNIX int ticksPerSecond = sysconf(_SC_CLK_TCK); if (ticksPerSecond < 0) // Shouldn't happen { throw SgException("Could not get _SC_CLK_TCK."); } g_ticksPerSecond = static_cast(ticksPerSecond); -#else -#error "Time functions not implemented" -#endif g_ticksPerMinute = 60 * g_ticksPerSecond; g_isInitialized = true; } @@ -79,7 +73,6 @@ double SgTime::Get(SgTimeMode mode) { if (! g_isInitialized) Init(); -#if UNIX switch (mode) { case SG_TIME_CPU: @@ -107,9 +100,6 @@ double SgTime::Get(SgTimeMode mode) SG_ASSERT(false); return 0; } -#else -#error "Time functions not implemented" -#endif } SgTimeMode SgTime::DefaultMode() diff --git a/smartgame/test/SgSystemTest.cpp b/smartgame/test/SgSystemTest.cpp index bfd78724..10c4ffde 100644 --- a/smartgame/test/SgSystemTest.cpp +++ b/smartgame/test/SgSystemTest.cpp @@ -27,11 +27,6 @@ BOOST_AUTO_TEST_CASE(SgSystemTestByteOrder) BOOST_CHECK_EQUAL(byteOrderTestByte, byteOrderTestValue); } -BOOST_AUTO_TEST_CASE(SgSystemTestDefines) -{ - BOOST_CHECK_EQUAL(MAC + UNIX, 1); -} - /** Check for a bug in std::bitset. This bug occurs on Mac OS X 10.3.8 (gcc version 3.3 20030304) in the debug version of bitset.h (used if _GLIBCXX_DEBUG is defined). diff --git a/unittestmain/Makefile.am b/unittestmain/Makefile.am index 0d2ce1ff..01894a96 100644 --- a/unittestmain/Makefile.am +++ b/unittestmain/Makefile.am @@ -73,7 +73,7 @@ fuego_unittest_DEPENDENCIES = \ ../gtpengine/libfuego_gtpengine.a fuego_unittest_CPPFLAGS = \ --DUNIX=1 $(BOOST_CPPFLAGS) \ +$(BOOST_CPPFLAGS) \ -I@top_srcdir@/gtpengine \ -I@top_srcdir@/smartgame \ -I@top_srcdir@/go \