Skip to content

Commit fc8431d

Browse files
committed
Feedback: Change from unreachable to abort.
1 parent 446e180 commit fc8431d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

source/common/ur_singleton.hpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <mutex>
1818
#include <unordered_map>
1919

20+
#include "logger/ur_logger.hpp"
21+
2022
//////////////////////////////////////////////////////////////////////////
2123
/// a abstract factory for creation of singleton objects
2224
template <typename singleton_tn, typename key_tn> class singleton_factory_t {
@@ -79,7 +81,8 @@ template <typename singleton_tn, typename key_tn> class singleton_factory_t {
7981
if (auto iter = map.find(getKey(key)); iter != map.end()) {
8082
iter->second.ref_count++;
8183
} else {
82-
__builtin_unreachable();
84+
logger::error("Invalid singleton key. Aborting.");
85+
std::abort();
8386
}
8487
}
8588

@@ -94,7 +97,8 @@ template <typename singleton_tn, typename key_tn> class singleton_factory_t {
9497
iter->second.ref_count--;
9598
}
9699
} else {
97-
__builtin_unreachable();
100+
logger::error("Invalid singleton key. Aborting.");
101+
std::abort();
98102
}
99103
}
100104

0 commit comments

Comments
 (0)