summaryrefslogtreecommitdiff
path: root/indra/llcommon/llinstancetracker.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2017-05-08 09:10:22 -0400
committerNat Goodspeed <nat@lindenlab.com>2017-05-08 09:10:22 -0400
commit93029a5a66f6797391a86affa40eb6185e291efc (patch)
tree1da629a2543f49ffb7cbe0e6095ff21f8a1ba711 /indra/llcommon/llinstancetracker.h
parent322767f98e3c3164e3be03daa85580038ca6fb52 (diff)
parent322c4c6bec54b4968d0105cf1bb28bb62c6dfcbc (diff)
Automated merge with ssh://bitbucket.org/lindenlab/viewer64
Diffstat (limited to 'indra/llcommon/llinstancetracker.h')
-rw-r--r--indra/llcommon/llinstancetracker.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 9783644e66..69c712b656 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -35,6 +35,24 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
+// As of 2017-05-06, as far as nat knows, only clang supports __has_feature().
+#if defined(LL_TEST_llinstancetracker) && defined(__clang__) && __has_feature(cxx_noexcept)
+// ~LLInstanceTracker() performs llassert_always() validation. That's fine in
+// production code, since the llassert_always() is implemented as an LL_ERRS
+// message, which will crash-with-message. In our integration test executable,
+// though, this llassert_always() throws an exception instead so we can test
+// error conditions and continue running the test. However -- as of C++11,
+// destructors are implicitly noexcept(true). Unless we mark
+// ~LLInstanceTracker() noexcept(false), the test executable crashes even on
+// the ATTEMPT to throw.
+#define LLINSTANCETRACKER_DTOR_NOEXCEPT noexcept(false)
+#else
+// If we're building for production, or in fact building *any other* test, or
+// we're using a compiler that doesn't support __has_feature(), or we're not
+// compiling with a C++ version that supports noexcept -- don't specify it.
+#define LLINSTANCETRACKER_DTOR_NOEXCEPT
+#endif
+
/**
* Base class manages "class-static" data that must actually have singleton
* semantics: one instance per process, rather than one instance per module as
@@ -198,11 +216,11 @@ protected:
getStatic();
add_(key);
}
- virtual ~LLInstanceTracker()
+ virtual ~LLInstanceTracker() LLINSTANCETRACKER_DTOR_NOEXCEPT
{
// it's unsafe to delete instances of this type while all instances are being iterated over.
llassert_always(getStatic().getDepth() == 0);
- remove_();
+ remove_();
}
virtual void setKey(KEY key) { remove_(); add_(key); }
virtual const KEY& getKey() const { return mInstanceKey; }
@@ -335,7 +353,7 @@ protected:
getStatic();
getSet_().insert(static_cast<T*>(this));
}
- virtual ~LLInstanceTracker()
+ virtual ~LLInstanceTracker() LLINSTANCETRACKER_DTOR_NOEXCEPT
{
// it's unsafe to delete instances of this type while all instances are being iterated over.
llassert_always(getStatic().getDepth() == 0);