Fix Ryzom server compile under MinGW

This commit is contained in:
kaetemi 2014-06-19 20:19:39 +02:00
parent 1c28c5bf6c
commit 69869d3a53
30 changed files with 91 additions and 42 deletions

View file

@ -74,7 +74,7 @@
namespace NLMISC namespace NLMISC
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
// Visual C++ warning : ebp maybe modified // Visual C++ warning : ebp maybe modified
# pragma warning(disable:4731) # pragma warning(disable:4731)
#endif #endif

View file

@ -152,7 +152,7 @@
// //
// NL_ISO_TEMPLATE_SPEC can be used in front of an instanciated class-template member data definition, // NL_ISO_TEMPLATE_SPEC can be used in front of an instanciated class-template member data definition,
// because sometimes MSVC++ 6 produces an error C2908 with a definition with template <>. // because sometimes MSVC++ 6 produces an error C2908 with a definition with template <>.
#if defined(NL_OS_WINDOWS) || (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3))) #if defined(NL_COMP_VC) || (defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)))
# define NL_ISO_SYNTAX 0 # define NL_ISO_SYNTAX 0
# define NL_ISO_TEMPLATE_SPEC # define NL_ISO_TEMPLATE_SPEC
#else #else
@ -398,8 +398,8 @@ typedef uint16 ucchar;
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
# if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 80) # if (NL_COMP_VC_VERSION >= 80)
# define INT64_CONSTANT(c) (c##LL) # define INT64_CONSTANT(c) (c##LL)
# define SINT64_CONSTANT(c) (c##LL) # define SINT64_CONSTANT(c) (c##LL)
# define UINT64_CONSTANT(c) (c##LL) # define UINT64_CONSTANT(c) (c##LL)

View file

@ -150,7 +150,11 @@ static string getSourceInfo (DWORD_TYPE addr)
return str; return str;
} }
static uintptr_t __stdcall GetModuleBase(HANDLE hProcess, uintptr_t dwReturnAddress) #ifdef NL_OS_WIN64
static DWORD64 __stdcall GetModuleBase(HANDLE hProcess, DWORD64 dwReturnAddress)
#else
static DWORD __stdcall GetModuleBase(HANDLE hProcess, DWORD dwReturnAddress)
#endif
{ {
IMAGEHLP_MODULE moduleInfo; IMAGEHLP_MODULE moduleInfo;
@ -291,12 +295,13 @@ static void displayCallStack (CLog *log)
#ifdef NL_OS_WIN64 #ifdef NL_OS_WIN64
MachineType = IMAGE_FILE_MACHINE_AMD64; MachineType = IMAGE_FILE_MACHINE_AMD64;
BOOL res = StackWalk64(MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL);
#else #else
MachineType = IMAGE_FILE_MACHINE_I386; MachineType = IMAGE_FILE_MACHINE_I386;
#endif BOOL res = StackWalk(MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
BOOL res = StackWalk (MachineType, GetCurrentProcess(), GetCurrentThread(), &callStack,
NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL); NULL, NULL, SymFunctionTableAccess, GetModuleBase, NULL);
#endif
/* if (res == FALSE) /* if (res == FALSE)
{ {

View file

@ -1150,7 +1150,7 @@ public:
typedef _CMirrorPropValueListIterator<T,CPropLocationClass> iterator; typedef _CMirrorPropValueListIterator<T,CPropLocationClass> iterator;
typedef _CCMirrorPropValueListIterator<T,CPropLocationClass> const_iterator; typedef _CCMirrorPropValueListIterator<T,CPropLocationClass> const_iterator;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
friend iterator; // MSVC friend iterator; // MSVC
friend const_iterator; friend const_iterator;
#else #else
@ -1192,7 +1192,7 @@ public:
// If changing this struct, don't forget to change the places where it is initialized // If changing this struct, don't forget to change the places where it is initialized
TSharedListRow Next; TSharedListRow Next;
T Value; T Value;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
}; };
#else #else
} __attribute__((packed)); } __attribute__((packed));
@ -1237,7 +1237,7 @@ public:
typedef _CMirrorPropValueListIterator<NLMISC::CEntityId,CPropLocationClass> iterator; typedef _CMirrorPropValueListIterator<NLMISC::CEntityId,CPropLocationClass> iterator;
typedef _CCMirrorPropValueListIterator<NLMISC::CEntityId,CPropLocationClass> const_iterator; typedef _CCMirrorPropValueListIterator<NLMISC::CEntityId,CPropLocationClass> const_iterator;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
friend iterator; // MSVC friend iterator; // MSVC
friend const_iterator; friend const_iterator;
#else #else
@ -1280,7 +1280,7 @@ public:
// If changing this struct, don't forget to change the places where it is initialized // If changing this struct, don't forget to change the places where it is initialized
TSharedListRow Next; TSharedListRow Next;
uint64 Value; uint64 Value;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
}; };
#else #else
} __attribute__((packed)); } __attribute__((packed));

View file

@ -55,7 +55,9 @@ template <class T>
class CTargetable class CTargetable
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
friend class CTargetable<T>; friend class CTargetable<T>;
# endif
#endif #endif
public: public:
typedef NLMISC::CDbgPtr<T> TPtr; typedef NLMISC::CDbgPtr<T> TPtr;

View file

@ -59,7 +59,7 @@ CSpawnGroupNpc::CSpawnGroupNpc(CPersistent<CSpawnGroup>& owner)
_LastUpdate = (randomVal>=0)?randomVal:CTimeInterface::gameCycle(); _LastUpdate = (randomVal>=0)?randomVal:CTimeInterface::gameCycle();
_LastBotUpdate = CTimeInterface::gameCycle(); _LastBotUpdate = CTimeInterface::gameCycle();
activityProfile().setAIProfile(new CGrpProfileNormal(this)); activityProfile().setAIProfile(new CGrpProfileNormal(this));
_BotUpdateTimer.set((CAIS::rand32(40)+((long)this>>2))%20); // start with a random value. _BotUpdateTimer.set((CAIS::rand32(40)+((intptr_t)this>>2))%20); // start with a random value.
resetSlowUpdateCycle(); resetSlowUpdateCycle();
_DespawnBotsWhenNoMoreHandleTimerActive = false; _DespawnBotsWhenNoMoreHandleTimerActive = false;
} }

View file

@ -38,7 +38,9 @@
#include "ais_user_models.h" #include "ais_user_models.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -191,7 +191,9 @@ namespace MULTI_LINE_FORMATER {
#include "ai_share/world_map.h" #include "ai_share/world_map.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -30,7 +30,9 @@
#include "web_connection.h" #include "web_connection.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -111,8 +111,8 @@ NL_ADD_RUNTIME_FLAGS(ryzom_entities_game_service)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH) IF(WITH_PCH AND NOT MINGW) # FIXME: PCH too large (> 130MB), crashes cc1plus under MinGW
ADD_NATIVE_PRECOMPILED_HEADER(ryzom_entities_game_service ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_entities_game_service ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH) ENDIF(WITH_PCH AND NOT MINGW)
INSTALL(TARGETS ryzom_entities_game_service RUNTIME DESTINATION sbin COMPONENT services) INSTALL(TARGETS ryzom_entities_game_service RUNTIME DESTINATION sbin COMPONENT services)

View file

@ -127,7 +127,9 @@
#include "server_share/stl_allocator_checker.h" #include "server_share/stl_allocator_checker.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -22,7 +22,9 @@
#include "fe_types.h" #include "fe_types.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX

View file

@ -57,7 +57,9 @@
#include "uid_impulsions.h" #include "uid_impulsions.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -178,7 +178,7 @@ void CModuleManager::addModule(uint id, TModuleExecCallback cb)
{ {
nlassert(id < _MaxModules); nlassert(id < _MaxModules);
nlassert(cb != NULL); nlassert(cb != NULL);
nldebug("FEMMAN: [%s] Added module %d (Cb=%p) to stack", _StackName.c_str(), id, cb); nldebug("FEMMAN: [%s] Added module %d (Cb=%p) to stack", _StackName.c_str(), id, (void *)cb);
_ExecutionStack.push_back(CExecutionItem()); _ExecutionStack.push_back(CExecutionItem());
@ -372,7 +372,7 @@ void CModuleManager::executeStack()
nlwarning("FEMMAN: Unexpected ExecutionItem type (%d) at item %d of the execution stack %s", item.Type, i, _StackName.c_str()); nlwarning("FEMMAN: Unexpected ExecutionItem type (%d) at item %d of the execution stack %s", item.Type, i, _StackName.c_str());
uint j; uint j;
for (j=0; j<_ExecutionStack.size(); ++j) for (j=0; j<_ExecutionStack.size(); ++j)
nlwarning("FEMMAN: > %d [%s] Id=%d Cb=%p", j, (item.Type == Module) ? "MOD" : (item.Type == Wait) ? "WAIT" : "ERR", item.Id, item.Cb); nlwarning("FEMMAN: > %d [%s] Id=%d Cb=%p", j, (item.Type == Module) ? "MOD" : (item.Type == Wait) ? "WAIT" : "ERR", item.Id, (void *)item.Cb);
nlerror("FEMMAN: Error in execution stack %s", _StackName.c_str()); nlerror("FEMMAN: Error in execution stack %s", _StackName.c_str());
} }
} }

View file

@ -34,7 +34,9 @@
#include "service_main.h" #include "service_main.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -50,7 +50,9 @@
#include "sheets.h" #include "sheets.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -47,7 +47,9 @@
*/ */
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -20,7 +20,9 @@
#include <nel/misc/variable.h> #include <nel/misc/variable.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -36,7 +36,9 @@
#include "log_storage.h" #include "log_storage.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -25,7 +25,9 @@
#include "hof_generator.h" #include "hof_generator.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -338,7 +338,7 @@ public:
// If changing this struct, don't forget to change the places where it is initialized // If changing this struct, don't forget to change the places where it is initialized
TSharedListRow Next; TSharedListRow Next;
T Value; T Value;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
}; };
#else #else
} __attribute__((packed)); } __attribute__((packed));
@ -409,7 +409,7 @@ void push_front( const NLMISC::CEntityId& value );
// If changing this struct, don't forget to change the places where it is initialized // If changing this struct, don't forget to change the places where it is initialized
TSharedListRow Next; TSharedListRow Next;
uint64 Value; uint64 Value;
#ifdef NL_OS_WINDOWS #ifdef NL_COMP_VC
}; };
#else #else
} __attribute__((packed)); } __attribute__((packed));

View file

@ -25,7 +25,9 @@
#include <nel/georges/load_form.h> #include <nel/georges/load_form.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -28,7 +28,9 @@
#include "messages.h" #include "messages.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <WinSock2.h> # include <WinSock2.h>
# include <Windows.h> # include <Windows.h>
typedef unsigned long ulong; typedef unsigned long ulong;

View file

@ -36,7 +36,9 @@
#include "patchman_tester.h" #include "patchman_tester.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -21,7 +21,9 @@
#include "delta_builder_task.h" #include "delta_builder_task.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -34,7 +34,9 @@
#include "service_main.h" #include "service_main.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -19,7 +19,9 @@
#include "db_manager.h" #include "db_manager.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -22,7 +22,9 @@
#include "nel/net/service.h" #include "nel/net/service.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -24,7 +24,9 @@
//#include <sys/utime.h> //#include <sys/utime.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

View file

@ -31,7 +31,9 @@
#include <string> #include <string>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS