From 5c66cbf374c5db3013858a5b3284f1efb49d1b09 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 7 Apr 2012 11:14:21 +0200 Subject: [PATCH] Changed: #1448 Compilation with CLang (patch provided by GelluleX, thanks !) --- code/CMakeModules/nel.cmake | 2 +- code/nel/include/nel/3d/computed_string.h | 6 +++++- code/nel/include/nel/3d/cube_grid.h | 2 +- code/nel/include/nel/3d/ps_attrib.h | 2 +- code/nel/include/nel/3d/static_quad_grid.h | 2 +- code/nel/include/nel/3d/track_tcb.h | 8 ++++---- code/nel/include/nel/misc/diff_tool.h | 4 ++-- code/ryzom/client/src/cdb.h | 10 +++++----- code/ryzom/client/src/r2/config_var.h | 16 ++++++++++++++++ .../src/game_share/mirror_prop_value_inline.h | 2 +- 10 files changed, 37 insertions(+), 17 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index bd92e743e..a02785a24 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -463,7 +463,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(NOT APPLE) 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) ENDMACRO(NL_SETUP_BUILD) diff --git a/code/nel/include/nel/3d/computed_string.h b/code/nel/include/nel/3d/computed_string.h index 16fe70fcb..914fa324e 100644 --- a/code/nel/include/nel/3d/computed_string.h +++ b/code/nel/include/nel/3d/computed_string.h @@ -27,12 +27,16 @@ #include #include +namespace NLMISC { + +class CMatrix; + +} namespace NL3D { class CTextureFont; -class CMatrix; struct CComputedString; // *************************************************************************** diff --git a/code/nel/include/nel/3d/cube_grid.h b/code/nel/include/nel/3d/cube_grid.h index 427aed624..483ea8000 100644 --- a/code/nel/include/nel/3d/cube_grid.h +++ b/code/nel/include/nel/3d/cube_grid.h @@ -227,7 +227,7 @@ void CCubeGrid::compile() // build the _StaticGrid _StaticGrids[i].build(_Grids[i]); // And reset the grid. contReset is necessary to clean the CBlockMemory. - contReset(_Grids[i]); + NLMISC::contReset(_Grids[i]); } // done diff --git a/code/nel/include/nel/3d/ps_attrib.h b/code/nel/include/nel/3d/ps_attrib.h index fc17dc787..83549a7b0 100644 --- a/code/nel/include/nel/3d/ps_attrib.h +++ b/code/nel/include/nel/3d/ps_attrib.h @@ -96,7 +96,7 @@ public: try { 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 diff --git a/code/nel/include/nel/3d/static_quad_grid.h b/code/nel/include/nel/3d/static_quad_grid.h index 7890e12f4..5a0383c9e 100644 --- a/code/nel/include/nel/3d/static_quad_grid.h +++ b/code/nel/include/nel/3d/static_quad_grid.h @@ -172,7 +172,7 @@ template void CStaticQuadGrid::build(CQuadGrid &quadGrid) { clear(); - contReset(_Grid); + NLMISC::contReset(_Grid); // Copy from quadGrid, and init quads _Size= quadGrid.getSize(); diff --git a/code/nel/include/nel/3d/track_tcb.h b/code/nel/include/nel/3d/track_tcb.h index 8daf5cc2a..fc9c227e4 100644 --- a/code/nel/include/nel/3d/track_tcb.h +++ b/code/nel/include/nel/3d/track_tcb.h @@ -218,7 +218,7 @@ protected: date*= previous->OODeltaTime; NLMISC::clamp(date, 0,1); - date = ease(previous, date); + date = this->ease(previous, date); float hb[4]; this->computeHermiteBasis(date, hb); @@ -242,7 +242,7 @@ protected: ITrackKeyFramer::compile(); // Ease Precompute. - compileTCBEase(this->_MapKey, this->getLoopMode()); + this->compileTCBEase(this->_MapKey, this->getLoopMode()); // Tangents Precompute. @@ -314,7 +314,7 @@ private: float ksm,ksp,kdm,kdp; // 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. TKeyValueType delm, delp; @@ -413,7 +413,7 @@ public: ITrackKeyFramer::compile(); // Ease Precompute. - compileTCBEase(_MapKey, getLoopMode()); + this->compileTCBEase(_MapKey, getLoopMode()); TMapTimeCKey::iterator it; TMapTimeCKey::iterator itNext; diff --git a/code/nel/include/nel/misc/diff_tool.h b/code/nel/include/nel/misc/diff_tool.h index 64989fcaf..2f291c6a0 100644 --- a/code/nel/include/nel/misc/diff_tool.h +++ b/code/nel/include/nel/misc/diff_tool.h @@ -501,8 +501,8 @@ namespace STRING_MANAGER // callback->onSwap(it - context.Reference.begin(), refCount, context); callback->onSwap(index, refCount, context); -// swap(*it, context.Reference[refCount]); - swap(context.Reference[index], context.Reference[refCount]); +// std::swap(*it, context.Reference[refCount]); + std::swap(context.Reference[index], context.Reference[refCount]); } } else if (getHashValue(context.Addition, addCount) != getHashValue(context.Reference, refCount)) diff --git a/code/ryzom/client/src/cdb.h b/code/ryzom/client/src/cdb.h index 24c2dd5eb..f8ad3148a 100644 --- a/code/ryzom/client/src/cdb.h +++ b/code/ryzom/client/src/cdb.h @@ -302,10 +302,10 @@ public : 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) - void setAtomic( bool atomicBranch ) { _Atomic = atomicBranch; } + void setAtomic( bool atomicBranch ) { _AtomicFlag = atomicBranch; } /// 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 virtual bool isLeaf() const = 0; @@ -333,14 +333,14 @@ public : protected: /// Constructor - ICDBNode() : _Atomic(false) + ICDBNode() : _AtomicFlag(false) { if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); _Name = NLMISC::CStringMapper::emptyId(); } /// Constructor - ICDBNode (const std::string &name) : _Atomic(false) + ICDBNode (const std::string &name) : _AtomicFlag(false) { if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); _Name = _DBSM->localMap(name); @@ -351,7 +351,7 @@ protected: void _buildFullName(NLMISC::CSString &fullName); /// 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 NLMISC::TStringId _Name; diff --git a/code/ryzom/client/src/r2/config_var.h b/code/ryzom/client/src/r2/config_var.h index 84c9f3891..674c38816 100644 --- a/code/ryzom/client/src/r2/config_var.h +++ b/code/ryzom/client/src/r2/config_var.h @@ -66,6 +66,22 @@ private: 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 const T &CConfigVar::get() const { // Relies on R2 'getConfigVarValue' and 'getConfigVarTypename' functions specialization to retrieve the value (see below) diff --git a/code/ryzom/common/src/game_share/mirror_prop_value_inline.h b/code/ryzom/common/src/game_share/mirror_prop_value_inline.h index cd4c71f4a..83bab3585 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value_inline.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value_inline.h @@ -1005,7 +1005,7 @@ NLNET::TServiceId8 CMirrorPropValueAlice::getWriterSer if ( _InMirror ) return CMirrorPropValue::getWriterServiceId(); else - return ~0; + return NLNET::TServiceId8(std::numeric_limits::max()); } #endif