diff options
author | Andrew Meadows <andrew@lindenlab.com> | 2013-01-03 22:34:34 +0000 |
---|---|---|
committer | Andrew Meadows <andrew@lindenlab.com> | 2013-01-03 22:34:34 +0000 |
commit | 6e82bb7789c1e046dcfb97c6773150df110153f8 (patch) | |
tree | c79b5a696c3f9ea3f617701018d7d9be22ed2a1b /indra/llcommon | |
parent | cda2cdda511eb2f7a58e284db2c852fd4a3808ae (diff) |
fixing linux compile errors for llcommon after LLTrace work
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llfasttimer.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llmemory.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llthreadlocalstorage.h | 21 | ||||
-rw-r--r-- | indra/llcommon/lltrace.h | 26 | ||||
-rw-r--r-- | 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<ThreadTimerStack> { - friend LLThreadLocalSingleton<ThreadTimerStack>; + friend class LLThreadLocalSingleton<ThreadTimerStack>; 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<typename DERIVED_TYPE> __declspec(thread) DERIVED_TYPE* LLThreadLocalSingleton<DERIVED_TYPE>::sInstance = NULL; template<typename DERIVED_TYPE> __declspec(thread) typename LLThreadLocalSingleton<DERIVED_TYPE>::EInitState LLThreadLocalSingleton<DERIVED_TYPE>::sInitState = LLThreadLocalSingleton<DERIVED_TYPE>::UNINITIALIZED; +#elif LL_LINUX +template<typename DERIVED_TYPE> +__thread DERIVED_TYPE* LLThreadLocalSingleton<DERIVED_TYPE>::sInstance = NULL; + +template<typename DERIVED_TYPE> +__thread typename LLThreadLocalSingleton<DERIVED_TYPE>::EInitState LLThreadLocalSingleton<DERIVED_TYPE>::sInitState = LLThreadLocalSingleton<DERIVED_TYPE>::UNINITIALIZED; +#endif template<typename DERIVED_TYPE> 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<typename DERIVED_TYPE> +#ifdef LL_WINDOWS __declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; +#elif LL_LINUX +__thread DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::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<T*> static size_t measure() { - return MemFootPrint<T>::measure(); + return MemFootprint<T>::measure(); } }; @@ -730,17 +730,17 @@ public: } // claim memory associated with other objects/data as our own, adding to our calculated footprint - template<typename T> - T& memClaim(T& value) + template<typename CLAIM_T> + CLAIM_T& memClaim(CLAIM_T& value) { - TrackMemImpl<T>::claim(*this, value); + TrackMemImpl<CLAIM_T>::claim(*this, value); return value; } - template<typename T> - const T& memClaim(const T& value) + template<typename CLAIM_T> + const CLAIM_T& memClaim(const CLAIM_T& value) { - TrackMemImpl<T>::claim(*this, value); + TrackMemImpl<CLAIM_T>::claim(*this, value); return value; } @@ -756,17 +756,17 @@ public: } // remove memory we had claimed from our calculated footprint - template<typename T> - T& memDisclaim(T& value) + template<typename CLAIM_T> + CLAIM_T& memDisclaim(CLAIM_T& value) { - TrackMemImpl<T>::disclaim(*this, value); + TrackMemImpl<CLAIM_T>::disclaim(*this, value); return value; } - template<typename T> - const T& memDisclaim(const T& value) + template<typename CLAIM_T> + const CLAIM_T& memDisclaim(const CLAIM_T& value) { - TrackMemImpl<T>::disclaim(*this, value); + TrackMemImpl<CLAIM_T>::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 <typename T> T getSum(const Count<T>& stat) const { - return (T)getSum(static_cast<const TraceType<CountAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getSum(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getPerSec(const TraceType<CountAccumulator<F64> >& stat) const; @@ -149,7 +149,7 @@ namespace LLTrace template <typename T> T getPerSec(const Count<T>& stat) const { - return (T)getPerSec(static_cast<const TraceType<CountAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getPerSec(static_cast<const TraceType<CountAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } U32 getSampleCount(const TraceType<CountAccumulator<F64> >& stat) const; @@ -162,7 +162,7 @@ namespace LLTrace template <typename T> T getSum(const Measurement<T>& stat) const { - return (T)getSum(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getSum(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getPerSec(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -170,7 +170,7 @@ namespace LLTrace template <typename T> T getPerSec(const Measurement<T>& stat) const { - return (T)getPerSec(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getPerSec(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getMin(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -178,7 +178,7 @@ namespace LLTrace template <typename T> T getMin(const Measurement<T>& stat) const { - return (T)getMin(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getMin(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getMax(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -186,7 +186,7 @@ namespace LLTrace template <typename T> T getMax(const Measurement<T>& stat) const { - return (T)getMax(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getMax(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getMean(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -194,7 +194,7 @@ namespace LLTrace template <typename T> T getMean(Measurement<T>& stat) const { - return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getStandardDeviation(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -202,7 +202,7 @@ namespace LLTrace template <typename T> T getStandardDeviation(const Measurement<T>& stat) const { - return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getMean(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } F64 getLastValue(const TraceType<MeasurementAccumulator<F64> >& stat) const; @@ -210,7 +210,7 @@ namespace LLTrace template <typename T> T getLastValue(const Measurement<T>& stat) const { - return (T)getLastValue(static_cast<const TraceType<MeasurementAccumulator<LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); + return (T)getLastValue(static_cast<const TraceType<MeasurementAccumulator<typename LLUnits::HighestPrecisionType<T>::type_t> >&> (stat)); } U32 getSampleCount(const TraceType<MeasurementAccumulator<F64> >& stat) const; |