aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/yassert.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/system/yassert.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/yassert.cpp')
-rw-r--r--util/system/yassert.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/util/system/yassert.cpp b/util/system/yassert.cpp
index c3557146d0..0f586648b7 100644
--- a/util/system/yassert.cpp
+++ b/util/system/yassert.cpp
@@ -1,8 +1,8 @@
-#include "yassert.h"
-
+#include "yassert.h"
+
#include "backtrace.h"
-#include "guard.h"
-#include "spinlock.h"
+#include "guard.h"
+#include "spinlock.h"
#include "src_root.h"
#include <util/datetime/base.h>
@@ -16,40 +16,40 @@
#include <cstdlib>
#include <stdarg.h>
#include <stdio.h>
-
+
#ifdef CLANG_COVERAGE
extern "C" {
- // __llvm_profile_write_file may not be provided if the executable target uses NO_CLANG_COVERAGE() macro and
- // arrives as test's dependency via DEPENDS() macro.
- // That's why we provide a weak no-op implementation for __llvm_profile_write_file,
- // which is used below in the code, to correctly save codecoverage profile before program exits using abort().
- Y_WEAK int __llvm_profile_write_file(void) {
- return 0;
- }
+ // __llvm_profile_write_file may not be provided if the executable target uses NO_CLANG_COVERAGE() macro and
+ // arrives as test's dependency via DEPENDS() macro.
+ // That's why we provide a weak no-op implementation for __llvm_profile_write_file,
+ // which is used below in the code, to correctly save codecoverage profile before program exits using abort().
+ Y_WEAK int __llvm_profile_write_file(void) {
+ return 0;
+ }
}
#endif
-namespace {
- struct TPanicLockHolder: public TAdaptiveLock {
- };
-}
+namespace {
+ struct TPanicLockHolder: public TAdaptiveLock {
+ };
+}
namespace NPrivate {
[[noreturn]] Y_NO_INLINE void InternalPanicImpl(int line, const char* function, const char* expr, int, int, int, const TStringBuf file, const char* errorMessage, size_t errorMessageSize) noexcept;
}
void ::NPrivate::Panic(const TStaticBuf& file, int line, const char* function, const char* expr, const char* format, ...) noexcept {
- try {
- // We care of panic of first failed thread only
- // Otherwise stderr could contain multiple messages and stack traces shuffled
- auto guard = Guard(*Singleton<TPanicLockHolder>());
+ try {
+ // We care of panic of first failed thread only
+ // Otherwise stderr could contain multiple messages and stack traces shuffled
+ auto guard = Guard(*Singleton<TPanicLockHolder>());
TString errorMsg;
- va_list args;
- va_start(args, format);
+ va_list args;
+ va_start(args, format);
// format has " " prefix to mute GCC warning on empty format
vsprintf(errorMsg, format[0] == ' ' ? format + 1 : format, args);
- va_end(args);
+ va_end(args);
constexpr int abiPlaceholder = 0;
::NPrivate::InternalPanicImpl(line, function, expr, abiPlaceholder, abiPlaceholder, abiPlaceholder, file.As<TStringBuf>(), errorMsg.c_str(), errorMsg.size());
@@ -66,7 +66,7 @@ namespace NPrivate {
const TString now = TInstant::Now().ToStringLocal();
TString r;
- TStringOutput o(r);
+ TStringOutput o(r);
if (expr) {
o << "VERIFY failed (" << now << "): " << errorMsg << Endl;
} else {
@@ -80,7 +80,7 @@ namespace NPrivate {
}
Cerr << r << Flush;
#ifndef WITH_VALGRIND
- PrintBackTrace();
+ PrintBackTrace();
#endif
#ifdef CLANG_COVERAGE
if (__llvm_profile_write_file()) {
@@ -88,7 +88,7 @@ namespace NPrivate {
}
#endif
abort();
- } catch (...) {
+ } catch (...) {
abort();
- }
+ }
}