From 662d6a17712fbba5cea0d9cf20f5a2f32e2dd537 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 26 Aug 2013 10:51:08 -0700 Subject: added compile time warnings to use of deprecated llinfos, llwarns, etc. --- indra/llcommon/llerror.h | 14 +++++++------- indra/llcommon/llpreprocessor.h | 13 +++++++++++++ indra/llui/llstatbar.cpp | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 6eaab450ed..88e5dfdcf1 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -355,13 +355,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/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/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& 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); -- cgit v1.2.3