From 6e82bb7789c1e046dcfb97c6773150df110153f8 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 3 Jan 2013 22:34:34 +0000 Subject: fixing linux compile errors for llcommon after LLTrace work --- indra/llcommon/llfasttimer.h | 2 +- indra/llcommon/llmemory.h | 1 + indra/llcommon/llthreadlocalstorage.h | 21 +++++++++++++++++++++ indra/llcommon/lltrace.h | 26 +++++++++++++------------- indra/llcommon/lltracerecording.h | 18 +++++++++--------- 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index 995eebd16a..fb2868ff98 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -49,7 +49,7 @@ class ThreadTimerStack : public BlockTimerStackRecord, public LLThreadLocalSingleton { - friend LLThreadLocalSingleton; + friend class LLThreadLocalSingleton; ThreadTimerStack() {} diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index e725bdd9fa..7e73afe06a 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -27,6 +27,7 @@ #define LLMEMORY_H #include "linden_common.h" +#include "stdint.h" class LLMutex ; diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index fdf0c18085..5a38d54eea 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -215,15 +215,28 @@ private: LLThreadLocalSingleton(const LLThreadLocalSingleton& other); virtual void initSingleton() {} +#ifdef LL_WINDOWS static __declspec(thread) DERIVED_TYPE* sInstance; static __declspec(thread) EInitState sInitState; +#elif LL_LINUX + static __thread DERIVED_TYPE* sInstance; + static __thread EInitState sInitState; +#endif }; +#ifdef LL_WINDOWS template __declspec(thread) DERIVED_TYPE* LLThreadLocalSingleton::sInstance = NULL; template __declspec(thread) typename LLThreadLocalSingleton::EInitState LLThreadLocalSingleton::sInitState = LLThreadLocalSingleton::UNINITIALIZED; +#elif LL_LINUX +template +__thread DERIVED_TYPE* LLThreadLocalSingleton::sInstance = NULL; + +template +__thread typename LLThreadLocalSingleton::EInitState LLThreadLocalSingleton::sInitState = LLThreadLocalSingleton::UNINITIALIZED; +#endif template class LLThreadLocalSingletonPointer @@ -245,10 +258,18 @@ public: } private: +#ifdef LL_WINDOWS static __declspec(thread) DERIVED_TYPE* sInstance; +#elif LL_LINUX + static __thread DERIVED_TYPE* sInstance; +#endif }; template +#ifdef LL_WINDOWS __declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; +#elif LL_LINUX +__thread DERIVED_TYPE* LLThreadLocalSingletonPointer::sInstance = NULL; +#endif #endif // LL_LLTHREADLOCALSTORAGE_H diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 285d4389af..e15cffd7d2 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -614,7 +614,7 @@ struct MemFootprint static size_t measure() { - return MemFootPrint::measure(); + return MemFootprint::measure(); } }; @@ -730,17 +730,17 @@ public: } // claim memory associated with other objects/data as our own, adding to our calculated footprint - template - T& memClaim(T& value) + template + CLAIM_T& memClaim(CLAIM_T& value) { - TrackMemImpl::claim(*this, value); + TrackMemImpl::claim(*this, value); return value; } - template - const T& memClaim(const T& value) + template + const CLAIM_T& memClaim(const CLAIM_T& value) { - TrackMemImpl::claim(*this, value); + TrackMemImpl::claim(*this, value); return value; } @@ -756,17 +756,17 @@ public: } // remove memory we had claimed from our calculated footprint - template - T& memDisclaim(T& value) + template + CLAIM_T& memDisclaim(CLAIM_T& value) { - TrackMemImpl::disclaim(*this, value); + TrackMemImpl::disclaim(*this, value); return value; } - template - const T& memDisclaim(const T& value) + template + const CLAIM_T& memDisclaim(const CLAIM_T& value) { - TrackMemImpl::disclaim(*this, value); + TrackMemImpl::disclaim(*this, value); return value; } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index f2d7d42211..aa3200e5ad 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -141,7 +141,7 @@ namespace LLTrace template T getSum(const Count& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -149,7 +149,7 @@ namespace LLTrace template T getPerSec(const Count& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; @@ -162,7 +162,7 @@ namespace LLTrace template T getSum(const Measurement& stat) const { - return (T)getSum(static_cast::type_t> >&> (stat)); + return (T)getSum(static_cast::type_t> >&> (stat)); } F64 getPerSec(const TraceType >& stat) const; @@ -170,7 +170,7 @@ namespace LLTrace template T getPerSec(const Measurement& stat) const { - return (T)getPerSec(static_cast::type_t> >&> (stat)); + return (T)getPerSec(static_cast::type_t> >&> (stat)); } F64 getMin(const TraceType >& stat) const; @@ -178,7 +178,7 @@ namespace LLTrace template T getMin(const Measurement& stat) const { - return (T)getMin(static_cast::type_t> >&> (stat)); + return (T)getMin(static_cast::type_t> >&> (stat)); } F64 getMax(const TraceType >& stat) const; @@ -186,7 +186,7 @@ namespace LLTrace template T getMax(const Measurement& stat) const { - return (T)getMax(static_cast::type_t> >&> (stat)); + return (T)getMax(static_cast::type_t> >&> (stat)); } F64 getMean(const TraceType >& stat) const; @@ -194,7 +194,7 @@ namespace LLTrace template T getMean(Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getStandardDeviation(const TraceType >& stat) const; @@ -202,7 +202,7 @@ namespace LLTrace template T getStandardDeviation(const Measurement& stat) const { - return (T)getMean(static_cast::type_t> >&> (stat)); + return (T)getMean(static_cast::type_t> >&> (stat)); } F64 getLastValue(const TraceType >& stat) const; @@ -210,7 +210,7 @@ namespace LLTrace template T getLastValue(const Measurement& stat) const { - return (T)getLastValue(static_cast::type_t> >&> (stat)); + return (T)getLastValue(static_cast::type_t> >&> (stat)); } U32 getSampleCount(const TraceType >& stat) const; -- cgit v1.2.3