Changed: #1448 Compilation with CLang (patch provided by GelluleX, thanks !)

This commit is contained in:
kervala 2012-04-07 11:14:21 +02:00
parent b1bfd3da01
commit 425927cd50
10 changed files with 37 additions and 17 deletions

View file

@ -463,7 +463,7 @@ MACRO(NL_SETUP_BUILD)
ENDIF(NOT APPLE) ENDIF(NOT APPLE)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG") SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3")
ENDIF(MSVC) ENDIF(MSVC)
ENDMACRO(NL_SETUP_BUILD) ENDMACRO(NL_SETUP_BUILD)

View file

@ -27,12 +27,16 @@
#include <vector> #include <vector>
#include <limits> #include <limits>
namespace NLMISC {
class CMatrix;
}
namespace NL3D { namespace NL3D {
class CTextureFont; class CTextureFont;
class CMatrix;
struct CComputedString; struct CComputedString;
// *************************************************************************** // ***************************************************************************

View file

@ -227,7 +227,7 @@ void CCubeGrid<TCell>::compile()
// build the _StaticGrid // build the _StaticGrid
_StaticGrids[i].build(_Grids[i]); _StaticGrids[i].build(_Grids[i]);
// And reset the grid. contReset is necessary to clean the CBlockMemory. // And reset the grid. contReset is necessary to clean the CBlockMemory.
contReset(_Grids[i]); NLMISC::contReset(_Grids[i]);
} }
// done // done

View file

@ -96,7 +96,7 @@ public:
try try
{ {
newStart = new uint8[sizeof(T) * capacity + (1 << snapPower)]; newStart = new uint8[sizeof(T) * capacity + (1 << snapPower)];
T *newTab = (T *) ( (uint) (newStart + (1 << snapPower)) & ~((1 << snapPower) - 1)); // snap to a page T *newTab = (T *) ( (size_t) (newStart + (1 << snapPower)) & ~((1 << snapPower) - 1)); // snap to a page

View file

@ -172,7 +172,7 @@ template<class T>
void CStaticQuadGrid<T>::build(CQuadGrid<T> &quadGrid) void CStaticQuadGrid<T>::build(CQuadGrid<T> &quadGrid)
{ {
clear(); clear();
contReset(_Grid); NLMISC::contReset(_Grid);
// Copy from quadGrid, and init quads // Copy from quadGrid, and init quads
_Size= quadGrid.getSize(); _Size= quadGrid.getSize();

View file

@ -218,7 +218,7 @@ protected:
date*= previous->OODeltaTime; date*= previous->OODeltaTime;
NLMISC::clamp(date, 0,1); NLMISC::clamp(date, 0,1);
date = ease(previous, date); date = this->ease(previous, date);
float hb[4]; float hb[4];
this->computeHermiteBasis(date, hb); this->computeHermiteBasis(date, hb);
@ -242,7 +242,7 @@ protected:
ITrackKeyFramer<CKeyT>::compile(); ITrackKeyFramer<CKeyT>::compile();
// Ease Precompute. // Ease Precompute.
compileTCBEase(this->_MapKey, this->getLoopMode()); this->compileTCBEase(this->_MapKey, this->getLoopMode());
// Tangents Precompute. // Tangents Precompute.
@ -314,7 +314,7 @@ private:
float ksm,ksp,kdm,kdp; float ksm,ksp,kdm,kdp;
// compute tangents factors. // compute tangents factors.
computeTCBFactors(key, timeBefore, time, timeAfter, rangeDelta, firstKey, endKey, isLoop, ksm,ksp,kdm,kdp); this->computeTCBFactors(key, timeBefore, time, timeAfter, rangeDelta, firstKey, endKey, isLoop, ksm,ksp,kdm,kdp);
// Delta. // Delta.
TKeyValueType delm, delp; TKeyValueType delm, delp;
@ -413,7 +413,7 @@ public:
ITrackKeyFramer<CKeyTCBQuat>::compile(); ITrackKeyFramer<CKeyTCBQuat>::compile();
// Ease Precompute. // Ease Precompute.
compileTCBEase(_MapKey, getLoopMode()); this->compileTCBEase(_MapKey, getLoopMode());
TMapTimeCKey::iterator it; TMapTimeCKey::iterator it;
TMapTimeCKey::iterator itNext; TMapTimeCKey::iterator itNext;

View file

@ -501,8 +501,8 @@ namespace STRING_MANAGER
// callback->onSwap(it - context.Reference.begin(), refCount, context); // callback->onSwap(it - context.Reference.begin(), refCount, context);
callback->onSwap(index, refCount, context); callback->onSwap(index, refCount, context);
// swap(*it, context.Reference[refCount]); // std::swap(*it, context.Reference[refCount]);
swap(context.Reference[index], context.Reference[refCount]); std::swap(context.Reference[index], context.Reference[refCount]);
} }
} }
else if (getHashValue(context.Addition, addCount) != getHashValue(context.Reference, refCount)) else if (getHashValue(context.Addition, addCount) != getHashValue(context.Reference, refCount))

View file

@ -302,10 +302,10 @@ public :
virtual CCDBNodeLeaf *findLeafAtCount( uint& count ) = 0; virtual CCDBNodeLeaf *findLeafAtCount( uint& count ) = 0;
/// Set the atomic branch flag (when all the modified nodes of a branch should be tranmitted at the same time) /// Set the atomic branch flag (when all the modified nodes of a branch should be tranmitted at the same time)
void setAtomic( bool atomicBranch ) { _Atomic = atomicBranch; } void setAtomic( bool atomicBranch ) { _AtomicFlag = atomicBranch; }
/// Return true if the branch has the atomic flag /// Return true if the branch has the atomic flag
bool isAtomic() const { return _Atomic; } bool isAtomic() const { return _AtomicFlag; }
// test if the node is a leaf // test if the node is a leaf
virtual bool isLeaf() const = 0; virtual bool isLeaf() const = 0;
@ -333,14 +333,14 @@ public :
protected: protected:
/// Constructor /// Constructor
ICDBNode() : _Atomic(false) ICDBNode() : _AtomicFlag(false)
{ {
if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper();
_Name = NLMISC::CStringMapper::emptyId(); _Name = NLMISC::CStringMapper::emptyId();
} }
/// Constructor /// Constructor
ICDBNode (const std::string &name) : _Atomic(false) ICDBNode (const std::string &name) : _AtomicFlag(false)
{ {
if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper();
_Name = _DBSM->localMap(name); _Name = _DBSM->localMap(name);
@ -351,7 +351,7 @@ protected:
void _buildFullName(NLMISC::CSString &fullName); void _buildFullName(NLMISC::CSString &fullName);
/// Atomic flag: is the branch an atomic group, or is the leaf a member of an atomic group /// Atomic flag: is the branch an atomic group, or is the leaf a member of an atomic group
bool _Atomic : 1; bool _AtomicFlag : 1;
/// Name of the node /// Name of the node
NLMISC::TStringId _Name; NLMISC::TStringId _Name;

View file

@ -66,6 +66,22 @@ private:
const T _Default; const T _Default;
}; };
// forward declarations for specialisations
std::string getConfigVarTypename(const float &dummy);
bool getConfigVarValue(CLuaObject &luaValue, float &dest);
std::string getConfigVarTypename(const double &dummy);
bool getConfigVarValue(CLuaObject &luaValue, double &dest);
std::string getConfigVarTypename(const sint32 &dummy);
bool getConfigVarValue(CLuaObject &luaValue, sint32 &dest);
std::string getConfigVarTypename(const std::string &dummy);
bool getConfigVarValue(CLuaObject &luaValue, std::string &dest);
std::string getConfigVarTypename(const NLMISC::CRGBA &dummy);
bool getConfigVarValue(CLuaObject &luaValue, NLMISC::CRGBA &dest);
template <class T> const T &CConfigVar<T>::get() const template <class T> const T &CConfigVar<T>::get() const
{ {
// Relies on R2 'getConfigVarValue' and 'getConfigVarTypename' functions specialization to retrieve the value (see below) // Relies on R2 'getConfigVarValue' and 'getConfigVarTypename' functions specialization to retrieve the value (see below)

View file

@ -1005,7 +1005,7 @@ NLNET::TServiceId8 CMirrorPropValueAlice<T,CPropLocationClass>::getWriterSer
if ( _InMirror ) if ( _InMirror )
return CMirrorPropValue<T,CPropLocationClass>::getWriterServiceId(); return CMirrorPropValue<T,CPropLocationClass>::getWriterServiceId();
else else
return ~0; return NLNET::TServiceId8(std::numeric_limits<uint8>::max());
} }
#endif #endif