parent
7fdbbfdf67
commit
0d89be4fbe
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,9 +1,11 @@
|
||||
.vscode
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
a.out
|
||||
build*/
|
||||
repro*/
|
||||
__pycache__
|
||||
__pycache__/
|
||||
scratch
|
||||
.vscode
|
||||
tmp
|
||||
bazel-*
|
||||
tmp/
|
||||
bazel-*/
|
||||
cmake-build-*/
|
||||
|
||||
@ -495,7 +495,7 @@ namespace cpptrace {
|
||||
namespace detail {
|
||||
std::atomic_bool absorb_trace_exceptions(true); // NOSONAR
|
||||
std::atomic_bool resolve_inlined_calls(true); // NOSONAR
|
||||
std::atomic<enum cache_mode> cache_mode(cache_mode::prioritize_speed); // NOSONAR
|
||||
std::atomic<cache_mode> current_cache_mode(cache_mode::prioritize_speed); // NOSONAR
|
||||
}
|
||||
|
||||
void absorb_trace_exceptions(bool absorb) {
|
||||
@ -508,7 +508,7 @@ namespace cpptrace {
|
||||
|
||||
namespace experimental {
|
||||
void set_cache_mode(cache_mode mode) {
|
||||
detail::cache_mode = mode;
|
||||
detail::current_cache_mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,8 +521,8 @@ namespace cpptrace {
|
||||
return resolve_inlined_calls;
|
||||
}
|
||||
|
||||
enum cache_mode get_cache_mode() {
|
||||
return cache_mode;
|
||||
cache_mode get_cache_mode() {
|
||||
return current_cache_mode;
|
||||
}
|
||||
|
||||
CPPTRACE_FORCE_NO_INLINE
|
||||
|
||||
@ -40,7 +40,7 @@ namespace detail {
|
||||
|
||||
bool should_absorb_trace_exceptions();
|
||||
bool should_resolve_inlined_calls();
|
||||
enum cache_mode get_cache_mode();
|
||||
cache_mode get_cache_mode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,15 +31,15 @@ namespace detail {
|
||||
// Lightweight std::source_location.
|
||||
struct source_location {
|
||||
const char* const file;
|
||||
//const char* const function; // disabled for now due to static constexpr restrictions
|
||||
const int line;
|
||||
constexpr source_location(
|
||||
//const char* _function /*= __builtin_FUNCTION()*/,
|
||||
const char* _file = __builtin_FILE(),
|
||||
int _line = __builtin_LINE()
|
||||
) : file(_file), /*function(_function),*/ line(_line) {}
|
||||
const char* _file,
|
||||
int _line
|
||||
) : file(_file), line(_line) {}
|
||||
};
|
||||
|
||||
#define CPPTRACE_CURRENT_LOCATION ::cpptrace::detail::source_location(__FILE__, __LINE__)
|
||||
|
||||
enum class assert_type {
|
||||
assert,
|
||||
verify,
|
||||
@ -117,7 +117,7 @@ namespace detail {
|
||||
}
|
||||
|
||||
// Check condition in both debug and release. std::runtime_error on failure.
|
||||
#define PANIC(...) ((::cpptrace::detail::panic)(CPPTRACE_PFUNC, {}, ::cpptrace::detail::as_string(__VA_ARGS__)))
|
||||
#define PANIC(...) ((::cpptrace::detail::panic)(CPPTRACE_PFUNC, CPPTRACE_CURRENT_LOCATION, ::cpptrace::detail::as_string(__VA_ARGS__)))
|
||||
|
||||
template<typename T>
|
||||
void assert_impl(
|
||||
@ -153,13 +153,13 @@ namespace detail {
|
||||
|
||||
// Check condition in both debug and release. std::runtime_error on failure.
|
||||
#define VERIFY(...) ( \
|
||||
assert_impl(__VA_ARGS__, ::cpptrace::detail::assert_type::verify, #__VA_ARGS__, CPPTRACE_PFUNC, {}) \
|
||||
assert_impl(__VA_ARGS__, ::cpptrace::detail::assert_type::verify, #__VA_ARGS__, CPPTRACE_PFUNC, CPPTRACE_CURRENT_LOCATION) \
|
||||
)
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Check condition in both debug. std::runtime_error on failure.
|
||||
#define ASSERT(...) ( \
|
||||
assert_impl(__VA_ARGS__, ::cpptrace::detail::assert_type::assert, #__VA_ARGS__, CPPTRACE_PFUNC, {}) \
|
||||
assert_impl(__VA_ARGS__, ::cpptrace::detail::assert_type::assert, #__VA_ARGS__, CPPTRACE_PFUNC, CPPTRACE_CURRENT_LOCATION) \
|
||||
)
|
||||
#else
|
||||
// Check condition in both debug. std::runtime_error on failure.
|
||||
|
||||
@ -496,8 +496,10 @@ namespace detail {
|
||||
template<
|
||||
typename T,
|
||||
typename D
|
||||
// workaround a msvc bug https://developercommunity.visualstudio.com/t/MSVC-1938331290-preview-fails-to-comp/10505565
|
||||
#if !defined(_MSC_VER) || _MSC_VER != 1938
|
||||
// workaround for:
|
||||
// == 19.38-specific msvc bug https://developercommunity.visualstudio.com/t/MSVC-1938331290-preview-fails-to-comp/10505565
|
||||
// <= 19.23 msvc also appears to fail (but for a different reason https://godbolt.org/z/6Y5EvdWPK)
|
||||
#if !defined(_MSC_VER) || !(_MSC_VER <= 1923 || _MSC_VER == 1938)
|
||||
,
|
||||
typename std::enable_if<
|
||||
std::is_same<decltype(std::declval<D>()(std::declval<T>())), void>::value,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user