From f648758c2a3da2dd03c8f57e98598c085b2030a6 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 16 Jan 2019 11:05:55 -0500
Subject: SL-10297: Modify LL_ERRS and other deliberate crashes to avoid a
 common stack frame

---
 indra/test/test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index b14c2eb255..125de72b79 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -146,7 +146,7 @@ public:
 		mOldSettings(LLError::saveAndResetSettings()),
 		mRecorder(new RecordToTempFile(pool))
 	{
-		LLError::setFatalFunction(wouldHaveCrashed);
+		LLError::overrideCrashOnError(wouldHaveCrashed);
 		LLError::setDefaultLevel(level);
 		LLError::addRecorder(mRecorder);
 	}
@@ -508,7 +508,7 @@ void stream_groups(std::ostream& s, const char* app)
 
 void wouldHaveCrashed(const std::string& message)
 {
-	tut::fail("llerrs message: " + message);
+	tut::fail("fatal error message: " + message);
 }
 
 static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL;
@@ -532,7 +532,7 @@ int main(int argc, char **argv)
 		LLError::initForApplication(".", ".", false /* do not log to stderr */);
 		LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
 	}	
-	LLError::setFatalFunction(wouldHaveCrashed);
+	LLError::overrideCrashOnError(wouldHaveCrashed);
 	std::string test_app_name(argv[0]);
 	std::string test_log = test_app_name + ".log";
 	LLFile::remove(test_log);
-- 
cgit v1.2.3


From e409c0492f1b1ce63606c0b693c92cdb36dcc28b Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Sat, 2 Mar 2019 11:58:11 -0500
Subject: convert to an explicit USE_BUGSPLAT switch in cmake, revise LL_ERRS
 approach

---
 indra/test/CMakeLists.txt |  6 +++++-
 indra/test/test.cpp       | 10 ++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index 8344cead57..7ac1f1db23 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -13,7 +13,7 @@ include(LLXML)
 include(Linking)
 include(Tut)
 include(LLAddBuildTest)
-
+include(bugsplat)
 include(GoogleMock)
 
 include_directories(
@@ -82,6 +82,10 @@ list(APPEND test_SOURCE_FILES ${test_HEADER_FILES})
 
 add_executable(lltest ${test_SOURCE_FILES})
 
+if (USE_BUGSPLAT)
+  set_target_properties(lltest PROPERTIES COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}")
+endif (USE_BUGSPLAT)
+
 target_link_libraries(lltest
     ${LLDATABASE_LIBRARIES}
     ${LLINVENTORY_LIBRARIES}
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 125de72b79..5dabcbbc58 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -75,7 +75,10 @@
 
 #include <fstream>
 
-void wouldHaveCrashed(const std::string& message);
+void wouldHaveCrashed(const std::string& message)
+{
+	tut::fail("fatal error message: " + message);
+}
 
 namespace tut
 {
@@ -506,11 +509,6 @@ void stream_groups(std::ostream& s, const char* app)
 	}
 }
 
-void wouldHaveCrashed(const std::string& message)
-{
-	tut::fail("fatal error message: " + message);
-}
-
 static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL;
 
 int main(int argc, char **argv)
-- 
cgit v1.2.3


From e86c0b3d0fbc5f91090241be959ef19bfffd8636 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 5 Mar 2019 04:44:29 -0500
Subject: fix error message reporting?

---
 indra/test/test.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 5dabcbbc58..4f966aede8 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -75,9 +75,10 @@
 
 #include <fstream>
 
-void wouldHaveCrashed(const std::string& message)
+LLError::ErrCrashHandlerResult wouldHaveCrashed(const std::string& message)
 {
 	tut::fail("fatal error message: " + message);
+    return LLError::ERR_DO_NOT_CRASH;
 }
 
 namespace tut
@@ -149,7 +150,7 @@ public:
 		mOldSettings(LLError::saveAndResetSettings()),
 		mRecorder(new RecordToTempFile(pool))
 	{
-		LLError::overrideCrashOnError(wouldHaveCrashed);
+		LLError::setFatalHandler(wouldHaveCrashed);
 		LLError::setDefaultLevel(level);
 		LLError::addRecorder(mRecorder);
 	}
@@ -530,7 +531,7 @@ int main(int argc, char **argv)
 		LLError::initForApplication(".", ".", false /* do not log to stderr */);
 		LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
 	}	
-	LLError::overrideCrashOnError(wouldHaveCrashed);
+	LLError::setFatalHandler(wouldHaveCrashed);
 	std::string test_app_name(argv[0]);
 	std::string test_log = test_app_name + ".log";
 	LLFile::remove(test_log);
-- 
cgit v1.2.3


From 07870a9ebb17e7a31df276f4ac2d8f52fec2a3b0 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 5 Mar 2019 13:57:02 -0500
Subject: rename crash handler to hook, and make them chainable by putting back
 the get and documenting it

---
 indra/test/test.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 4f966aede8..52ac855d9f 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -75,7 +75,7 @@
 
 #include <fstream>
 
-LLError::ErrCrashHandlerResult wouldHaveCrashed(const std::string& message)
+LLError::ErrFatalHookResult wouldHaveCrashed(const std::string& message)
 {
 	tut::fail("fatal error message: " + message);
     return LLError::ERR_DO_NOT_CRASH;
@@ -150,7 +150,7 @@ public:
 		mOldSettings(LLError::saveAndResetSettings()),
 		mRecorder(new RecordToTempFile(pool))
 	{
-		LLError::setFatalHandler(wouldHaveCrashed);
+		LLError::setFatalHook(wouldHaveCrashed);
 		LLError::setDefaultLevel(level);
 		LLError::addRecorder(mRecorder);
 	}
@@ -531,7 +531,7 @@ int main(int argc, char **argv)
 		LLError::initForApplication(".", ".", false /* do not log to stderr */);
 		LLError::setDefaultLevel(LLError::LEVEL_DEBUG);
 	}	
-	LLError::setFatalHandler(wouldHaveCrashed);
+	LLError::setFatalHook(wouldHaveCrashed);
 	std::string test_app_name(argv[0]);
 	std::string test_log = test_app_name + ".log";
 	LLFile::remove(test_log);
-- 
cgit v1.2.3


From 46fb225134ef871a686d0571cc55256923eee110 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 21 May 2019 12:09:26 -0400
Subject: suppress unreachable code warning because tut::fail triggers it

---
 indra/test/test.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 52ac855d9f..9d327ff3be 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -57,16 +57,11 @@
 #include <gtest/gtest.h>
 #endif
 
-#if LL_MSVC
-#pragma warning (push)
+#if LL_WINDOWS
 #pragma warning (disable : 4702) // warning C4702: unreachable code
 #endif
 #include <boost/iostreams/tee.hpp>
 #include <boost/iostreams/stream.hpp>
-#if LL_MSVC
-#pragma warning (pop)
-#endif
-
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/make_shared.hpp>
-- 
cgit v1.2.3


From 4e4564dcf31766469ccf41e0eef82bc234fda72c Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 26 Aug 2020 09:53:38 -0400
Subject: SL-10297 fix MSVC warning controls (merge error)

---
 indra/test/test.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index b16fcb84d6..748d042631 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -58,7 +58,8 @@
 #include <gtest/gtest.h>
 #endif
 
-#if LL_WINDOWS
+#if LL_MSVC
+#pragma warning (push)
 #pragma warning (disable : 4702) // warning C4702: unreachable code
 #endif
 #include <boost/iostreams/tee.hpp>
-- 
cgit v1.2.3


From 1aa140d3affa28d85a41d55f2566a19fb9d2cff5 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 26 Aug 2020 15:33:20 -0400
Subject: SL-10297 fix MSVC unreachable code warning

---
 indra/test/test.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 748d042631..55dad94bc1 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -77,8 +77,14 @@
 
 LLError::ErrFatalHookResult wouldHaveCrashed(const std::string& message)
 {
+#if LL_MSVC
+#pragma warning (push)
+#pragma warning (disable : 4702) // warning C4702: unreachable code
 	tut::fail("fatal error message: " + message);
     return LLError::ERR_DO_NOT_CRASH;
+#if LL_MSVC
+#pragma warning (pop)
+#endif
 }
 
 namespace tut
-- 
cgit v1.2.3


From 6007475c87d3edbb023cc64bb097d33e6c04dfd4 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Wed, 26 Aug 2020 16:37:23 -0400
Subject: SL-10297 fix MSVC unreachable code warning (for real)

---
 indra/test/test.cpp | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 55dad94bc1..571f502861 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -80,6 +80,7 @@ LLError::ErrFatalHookResult wouldHaveCrashed(const std::string& message)
 #if LL_MSVC
 #pragma warning (push)
 #pragma warning (disable : 4702) // warning C4702: unreachable code
+#endif
 	tut::fail("fatal error message: " + message);
     return LLError::ERR_DO_NOT_CRASH;
 #if LL_MSVC
-- 
cgit v1.2.3


From 28862ab53b9e532bf6ff789743d80b33af10f395 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 12 May 2021 14:21:27 -0400
Subject: SL-10297: Clean up a few merge glitches.

---
 indra/test/test.cpp | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

(limited to 'indra/test')

diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 571f502861..87c4a8d8a3 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -75,18 +75,7 @@
 
 #include <fstream>
 
-LLError::ErrFatalHookResult wouldHaveCrashed(const std::string& message)
-{
-#if LL_MSVC
-#pragma warning (push)
-#pragma warning (disable : 4702) // warning C4702: unreachable code
-#endif
-	tut::fail("fatal error message: " + message);
-    return LLError::ERR_DO_NOT_CRASH;
-#if LL_MSVC
-#pragma warning (pop)
-#endif
-}
+void wouldHaveCrashed(const std::string& message);
 
 namespace tut
 {
@@ -157,7 +146,7 @@ public:
 		mOldSettings(LLError::saveAndResetSettings()),
 		mRecorder(new RecordToTempFile(pool))
 	{
-		LLError::setFatalHook(wouldHaveCrashed);
+		LLError::setFatalFunction(wouldHaveCrashed);
 		LLError::setDefaultLevel(level);
 		LLError::addRecorder(mRecorder);
 	}
@@ -523,6 +512,11 @@ void stream_groups(std::ostream& s, const char* app)
 	}
 }
 
+void wouldHaveCrashed(const std::string& message)
+{
+	tut::fail("llerrs message: " + message);
+}
+
 static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL;
 
 int main(int argc, char **argv)
@@ -632,7 +626,7 @@ int main(int argc, char **argv)
 			replayer.reset(new LLReplayLogReal(level, gAPRPoolp));
 		}
 	}
-	LLError::setFatalHook(wouldHaveCrashed);
+	LLError::setFatalFunction(wouldHaveCrashed);
 	std::string test_app_name(argv[0]);
 	std::string test_log = test_app_name + ".log";
 	LLFile::remove(test_log);
-- 
cgit v1.2.3