summaryrefslogtreecommitdiff
path: root/indra/llcommon/llerror.h
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2019-03-08 13:39:56 -0800
committerNat Goodspeed <nat@lindenlab.com>2020-03-25 18:39:21 -0400
commita6f31e9167c75982bb5eaba96ec6ac1f70ee31fb (patch)
treee593f0cfe4a581464119daf53f10bf58ac0cf0e6 /indra/llcommon/llerror.h
parent6992ad457c04a2f9b4dee96c19d1e0df3c870dbc (diff)
Fixed variadic macro usage in LL_ERRS_IF and LL_WARNS_IF and improved LLError::shouldLogToStderr() behavior under xcode.
Diffstat (limited to 'indra/llcommon/llerror.h')
-rw-r--r--indra/llcommon/llerror.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 0a78229555..9613911531 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -381,8 +381,13 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, ##__VA_ARGS__)
#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, ##__VA_ARGS__)
// alternative to llassert_always that prints explanatory message
-#define LL_WARNS_IF(exp, ...) if (exp) LL_WARNS(##__VA_ARGS__) << "(" #exp ")"
-#define LL_ERRS_IF(exp, ...) if (exp) LL_ERRS(##__VA_ARGS__) << "(" #exp ")"
+// note ## token paste operator hack used above will only work in gcc following
+// a comma and is completely unnecessary in VS since the comma is automatically
+// suppressed
+// https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
+// https://docs.microsoft.com/en-us/cpp/preprocessor/variadic-macros?view=vs-2015
+#define LL_WARNS_IF(exp, ...) if (exp) LL_WARNS(__VA_ARGS__) << "(" #exp ")"
+#define LL_ERRS_IF(exp, ...) if (exp) LL_ERRS(__VA_ARGS__) << "(" #exp ")"
// Only print the log message once (good for warnings or infos that would otherwise
// spam the log file over and over, such as tighter loops).