summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llcommon/llerror.h14
-rwxr-xr-xindra/llcommon/llmemory.cpp4
-rwxr-xr-xindra/llcommon/llpreprocessor.h13
-rw-r--r--indra/llcommon/llunit.h40
-rw-r--r--indra/llcommon/tests/llunits_test.cpp1
-rwxr-xr-xindra/llui/llstatbar.cpp2
-rw-r--r--indra/newview/llscenemonitor.cpp31
-rwxr-xr-xindra/newview/llviewermessage.cpp4
8 files changed, 67 insertions, 42 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 6cac952b7e..0d6f1810d2 100755
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -356,13 +356,13 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, ##__VA_ARGS__)
#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, ##__VA_ARGS__)
-
// DEPRECATED: Use the new macros that allow tags and *look* like macros.
-//#define lldebugs LL_DEBUGS()
-#define llinfos LL_INFOS()
-//#define llwarns LL_WARNS()
-//#define llerrs LL_ERRS()
-//#define llcont LL_CONT
-#define llendl LL_ENDL
+#define lldebugs LL_COMPILE_TIME_WARNING("Warning: lldebugs deprecated, use LL_DEBUGS() instead"); LL_DEBUGS()
+#define llinfos LL_COMPILE_TIME_WARNING("Warning: llinfos deprecated, use LL_INFOS() instead"); LL_INFOS()
+#define llwarns LL_COMPILE_TIME_WARNING("Warning: llwarns deprecated, use LL_WARNS() instead"); LL_WARNS()
+#define llerrs LL_COMPILE_TIME_WARNING("Warning: llerrs deprecated, use LL_ERRS() instead"); LL_ERRS()
+#define llcont LL_COMPILE_TIME_WARNING("Warning: llcont deprecated, use LL_CONT instead"); LL_CONT
+#define llendl LL_COMPILE_TIME_WARNING("Warning: llendl deprecated, use LL_ENDL instead"); LL_ENDL
+
#endif // LL_LLERROR_H
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 06334c012a..cb2f853070 100755
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -206,8 +206,8 @@ bool LLMemory::isMemoryPoolLow()
return true ;
}
- bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD ||
- sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ;
+ bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD
+ || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ;
//check the virtual address space fragmentation
if(!is_low)
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index e5c8482ed1..eea63d443f 100755
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -188,4 +188,17 @@
#elif LL_DARWIN
#define LL_TYPEOF(exp) typeof(exp)
#endif
+
+#define LL_TO_STRING_HELPER(x) #x
+#define LL_TO_STRING(x) LL_TO_STRING_HELPER(x)
+#define LL_FILE_LINENO(msg) __FILE__ "(" LL_TO_STRING(__LINE__) ") : " msg
+#if LL_WINDOWS
+#define LL_COMPILE_TIME_WARNING(msg) __pragma(message(LL_FILE_LINENO(msg)))
+#define LL_COMPILE_TIME_ERROR(msg) static_assert(false, msg)
+#else
+// no way to get gcc 4.2 to print a user-defined diagnostic message only when a macro is used
+#define LL_COMPILE_TIME_WARNING(msg)
+#define LL_COMPILE_TIME_ERROR(msg)
+#endif
+
#endif // not LL_LINDEN_PREPROCESSOR_H
diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h
index de9cee33fd..0081b51f84 100644
--- a/indra/llcommon/llunit.h
+++ b/indra/llcommon/llunit.h
@@ -82,24 +82,16 @@ struct LLUnit
typedef STORAGE_TYPE storage_t;
// value initialization
- explicit LLUnit(storage_t value = storage_t())
+ LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t())
: mValue(value)
{}
// unit initialization and conversion
template<typename OTHER_STORAGE, typename OTHER_UNIT>
- LLUnit(LLUnit<OTHER_STORAGE, OTHER_UNIT> other)
+ LL_FORCE_INLINE LLUnit(LLUnit<OTHER_STORAGE, OTHER_UNIT> other)
: mValue(convert(other).mValue)
{}
- // unit assignment
- template<typename OTHER_STORAGE, typename OTHER_UNIT>
- self_t& operator = (LLUnit<OTHER_STORAGE, OTHER_UNIT> other)
- {
- mValue = convert(other).mValue;
- return *this;
- }
-
storage_t value() const
{
return mValue;
@@ -122,14 +114,12 @@ struct LLUnit
*this = LLUnit<storage_t, NEW_UNIT_TYPE>(value);
}
- template<typename OTHER_STORAGE, typename OTHER_UNIT>
- void operator += (LLUnit<OTHER_STORAGE, OTHER_UNIT> other)
+ void operator += (self_t other)
{
mValue += convert(other).mValue;
}
- template<typename OTHER_STORAGE, typename OTHER_UNIT>
- void operator -= (LLUnit<OTHER_STORAGE, OTHER_UNIT> other)
+ void operator -= (self_t other)
{
mValue -= convert(other).mValue;
}
@@ -139,8 +129,7 @@ struct LLUnit
mValue *= multiplicand;
}
- template<typename OTHER_UNIT, typename OTHER_STORAGE>
- void operator *= (LLUnit<OTHER_STORAGE, OTHER_UNIT> multiplicand)
+ void operator *= (self_t multiplicand)
{
// spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template
LL_BAD_TEMPLATE_INSTANTIATION(OTHER_UNIT, "Multiplication of unit types not supported.");
@@ -151,15 +140,14 @@ struct LLUnit
mValue /= divisor;
}
- template<typename OTHER_UNIT, typename OTHER_STORAGE>
- void operator /= (LLUnit<OTHER_STORAGE, OTHER_UNIT> divisor)
+ void operator /= (self_t divisor)
{
// spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template
LL_BAD_TEMPLATE_INSTANTIATION(OTHER_UNIT, "Illegal in-place division of unit types.");
}
template<typename SOURCE_STORAGE, typename SOURCE_UNITS>
- static self_t convert(LLUnit<SOURCE_STORAGE, SOURCE_UNITS> v)
+ LL_FORCE_INLINE static self_t convert(LLUnit<SOURCE_STORAGE, SOURCE_UNITS> v)
{
typedef typename LLResultTypePromote<STORAGE_TYPE, SOURCE_STORAGE>::type_t result_storage_t;
LLUnit<result_storage_t, UNIT_TYPE> result;
@@ -258,7 +246,7 @@ std::istream& operator >>(std::istream& s, LLUnitImplicit<STORAGE_TYPE, UNIT_TYP
}
template<typename S1, typename T1, typename S2, typename T2>
-LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out, ...)
+LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out)
{
S2 divisor(1);
@@ -272,7 +260,7 @@ LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out, ...)
// T1 and T2 same type, just assign
out.value((S2)in.value());
}
- else if (LLIsSameType<T2, typename T2::base_unit_t>::value)
+ else if (T1::sLevel > T2::sLevel)
{
// reduce T1
LLUnit<S2, typename T1::base_unit_t> new_in;
@@ -301,6 +289,10 @@ struct LLStorageType<LLUnit<STORAGE_TYPE, UNIT_TYPE> >
typedef STORAGE_TYPE type_t;
};
+// all of these operators need to perform type promotion on the storage type of the units, so they
+// cannot be expressed as operations on identical types with implicit unit conversion
+// e.g. typeof(S32Bytes(x) + F32Megabytes(y)) <==> F32Bytes
+
//
// operator +
//
@@ -681,6 +673,7 @@ struct LLUnitInverseLinearOps
#define LL_DECLARE_BASE_UNIT(base_unit_name, unit_label) \
struct base_unit_name \
{ \
+ static const int sLevel = 0; \
typedef base_unit_name base_unit_t; \
static const char* getUnitLabel() { return unit_label; } \
template<typename T> \
@@ -694,6 +687,7 @@ struct base_unit_name
#define LL_DECLARE_DERIVED_UNIT(base_unit_name, conversion_operation, unit_name, unit_label) \
struct unit_name \
{ \
+ static const int sLevel = base_unit_name::sLevel + 1; \
typedef base_unit_name base_unit_t; \
static const char* getUnitLabel() { return unit_label; } \
template<typename T> \
@@ -704,7 +698,7 @@ struct unit_name
}; \
\
template<typename S1, typename S2> \
-S2 ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \
+LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \
{ \
typedef typename LLResultTypePromote<S1, S2>::type_t result_storage_t; \
LLUnitLinearOps<result_storage_t> op = \
@@ -714,7 +708,7 @@ S2 ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out)
} \
\
template<typename S1, typename S2> \
-S2 ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \
+LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \
{ \
typedef typename LLResultTypePromote<S1, S2>::type_t result_storage_t; \
LLUnitInverseLinearOps<result_storage_t> op = \
diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp
index 292c6122af..31d4f86159 100644
--- a/indra/llcommon/tests/llunits_test.cpp
+++ b/indra/llcommon/tests/llunits_test.cpp
@@ -271,6 +271,5 @@ namespace tut
mega_bytes = (U32Megabytes)5 + (S32Megabytes)-1;
ensure("can mix unsigned and signed in units addition", mega_bytes == (S32Megabytes)4);
-
}
}
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 3cd2e53001..725a835f7f 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -325,7 +325,7 @@ void LLStatBar::draw()
{
const LLTrace::TraceType<LLTrace::CountAccumulator>& count_stat = *mCountFloatp;
- unit_label = mUnitLabel.empty() ? (std::string(count_stat.getUnitLabel()) + "/s") : mUnitLabel;
+ unit_label = std::string(count_stat.getUnitLabel()) + "/s";
current = last_frame_recording.getPerSec(count_stat);
min = frame_recording.getPeriodMinPerSec(count_stat, num_frames);
max = frame_recording.getPeriodMaxPerSec(count_stat, num_frames);
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 7fafabb493..57d58a9d4e 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -565,8 +565,9 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
for (S32 frame = 1; frame <= frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getSum(*it);
+ Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(*it);
+ row << ", " << recording.getSum(*it);
}
row << '\n';
@@ -597,8 +598,17 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
for (S32 frame = 1; frame <= frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
+ Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(*it);
+ F64 mean = recording.getMean(*it);
+ if (llisnan(mean))
+ {
+ row << ", n/a";
+ }
+ else
+ {
+ row << ", " << mean;
+ }
}
row << '\n';
@@ -629,8 +639,17 @@ void LLSceneMonitor::dumpToFile(std::string file_name)
for (S32 frame = 1; frame <= frame_count; frame++)
{
- samples += scene_load_recording.getPrevRecording(frame_count - frame).getSampleCount(*it);
- row << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMean(*it);
+ Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame);
+ samples += recording.getSampleCount(*it);
+ F64 mean = recording.getMean(*it);
+ if (llisnan(mean))
+ {
+ row << ", n/a";
+ }
+ else
+ {
+ row << ", " << mean;
+ }
}
row << '\n';
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index b4ed2adb07..7de8e1ff12 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -7219,10 +7219,10 @@ void process_script_teleport_request(LLMessageSystem* msg, void**)
LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
if(instance)
{
- llinfos << "Object named " << object_name
+ LL_INFOS() << "Object named " << object_name
<< " is offering TP to region "
<< sim_name << " position " << pos
- << llendl;
+ << LL_ENDL;
instance->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]);
LLFloaterReg::showInstance("world_map", "center");