Skip to content

Commit

Permalink
Don't use UNIX compilation macro anymore
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/fuego/code/trunk@569 2e953b5c-c64d-0410-be54-f773e93e544c
  • Loading branch information
enz committed Oct 3, 2008
1 parent 2b283f9 commit d7a9589
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 54 deletions.
2 changes: 1 addition & 1 deletion build/gmake/fuegomain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/fuegotest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/gouct/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/gtpengine/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/simpleplayers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/smartgame/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion build/gmake/unittestmain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion fuegomain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion fuegotest/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion go/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion gouct/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion simpleplayers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion smartgame/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ SgUtil.h \
SgWrite.h

libfuego_smartgame_a_CPPFLAGS = \
-DUNIX=1 $(BOOST_CPPFLAGS) \
$(BOOST_CPPFLAGS) \
-I@top_srcdir@/gtpengine

DISTCLEANFILES = *~
6 changes: 3 additions & 3 deletions smartgame/SgDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ static ofstream s_nullStream;

static auto_ptr<ofstream> s_fileStream;

#if UNIX
#define textoutputstream cerr
#else
#if MAC
#define textoutputstream cout
#else
#define textoutputstream cerr
#endif

ostream* g_debugStrPtr(&textoutputstream);
Expand Down
2 changes: 1 addition & 1 deletion smartgame/SgDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
23 changes: 3 additions & 20 deletions smartgame/SgSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -75,17 +59,16 @@ inline void SG_UNUSED(const T&)

//----------------------------------------------------------------------------

#if UNIX
#if MAC
#define OTHER_BYTE_ORDER 0
#else
#include <sys/types.h>
#if (BYTE_ORDER == BIG_ENDIAN)
#define OTHER_BYTE_ORDER 0
#else
#define OTHER_BYTE_ORDER 1
#endif
#endif
#if MAC
#define OTHER_BYTE_ORDER 0
#endif

//----------------------------------------------------------------------------

Expand Down
10 changes: 0 additions & 10 deletions smartgame/SgTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
#include <limits>
#include <iostream>
#include <sstream>
#if UNIX
#include <errno.h>
#include <sys/time.h>
#include <sys/times.h>
#include <unistd.h>
#endif
#include "SgException.h"

using namespace std;
Expand All @@ -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<clock_t>(ticksPerSecond);
#else
#error "Time functions not implemented"
#endif
g_ticksPerMinute = 60 * g_ticksPerSecond;
g_isInitialized = true;
}
Expand Down Expand Up @@ -79,7 +73,6 @@ double SgTime::Get(SgTimeMode mode)
{
if (! g_isInitialized)
Init();
#if UNIX
switch (mode)
{
case SG_TIME_CPU:
Expand Down Expand Up @@ -107,9 +100,6 @@ double SgTime::Get(SgTimeMode mode)
SG_ASSERT(false);
return 0;
}
#else
#error "Time functions not implemented"
#endif
}

SgTimeMode SgTime::DefaultMode()
Expand Down
5 changes: 0 additions & 5 deletions smartgame/test/SgSystemTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion unittestmain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit d7a9589

Please sign in to comment.