aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/re2/util/logging.h
diff options
context:
space:
mode:
authorAndrey Khalyavin <halyavin@gmail.com>2022-02-10 16:46:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:30 +0300
commit4b839d0704ee9be1dabb0310a1f03af24963637b (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/re2/util/logging.h
parentf773626848a7c7456803654292e716b83d69cc12 (diff)
downloadydb-4b839d0704ee9be1dabb0310a1f03af24963637b.tar.gz
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/re2/util/logging.h')
-rw-r--r--contrib/libs/re2/util/logging.h214
1 files changed, 107 insertions, 107 deletions
diff --git a/contrib/libs/re2/util/logging.h b/contrib/libs/re2/util/logging.h
index 924e2165f6..5b2217f29c 100644
--- a/contrib/libs/re2/util/logging.h
+++ b/contrib/libs/re2/util/logging.h
@@ -1,109 +1,109 @@
-// Copyright 2009 The RE2 Authors. All Rights Reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#ifndef UTIL_LOGGING_H_
-#define UTIL_LOGGING_H_
-
-// Simplified version of Google's logging.
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ostream>
-#include <sstream>
-
-#include "util/util.h"
-
-// Debug-only checking.
-#define DCHECK(condition) assert(condition)
-#define DCHECK_EQ(val1, val2) assert((val1) == (val2))
-#define DCHECK_NE(val1, val2) assert((val1) != (val2))
-#define DCHECK_LE(val1, val2) assert((val1) <= (val2))
-#define DCHECK_LT(val1, val2) assert((val1) < (val2))
-#define DCHECK_GE(val1, val2) assert((val1) >= (val2))
-#define DCHECK_GT(val1, val2) assert((val1) > (val2))
-
-// Always-on checking
-#define CHECK(x) if(x){}else LogMessageFatal(__FILE__, __LINE__).stream() << "Check failed: " #x
-#define CHECK_LT(x, y) CHECK((x) < (y))
-#define CHECK_GT(x, y) CHECK((x) > (y))
-#define CHECK_LE(x, y) CHECK((x) <= (y))
-#define CHECK_GE(x, y) CHECK((x) >= (y))
-#define CHECK_EQ(x, y) CHECK((x) == (y))
-#define CHECK_NE(x, y) CHECK((x) != (y))
-
-#define LOG_INFO LogMessage(__FILE__, __LINE__)
-#define LOG_WARNING LogMessage(__FILE__, __LINE__)
-#define LOG_ERROR LogMessage(__FILE__, __LINE__)
-#define LOG_FATAL LogMessageFatal(__FILE__, __LINE__)
-#define LOG_QFATAL LOG_FATAL
-
-// It seems that one of the Windows header files defines ERROR as 0.
-#ifdef _WIN32
-#define LOG_0 LOG_INFO
-#endif
-
-#ifdef NDEBUG
-#define LOG_DFATAL LOG_ERROR
-#else
-#define LOG_DFATAL LOG_FATAL
-#endif
-
-#define LOG(severity) LOG_ ## severity.stream()
-
-#define VLOG(x) if((x)>0){}else LOG_INFO.stream()
-
-class LogMessage {
- public:
- LogMessage(const char* file, int line)
- : flushed_(false) {
- stream() << file << ":" << line << ": ";
- }
- void Flush() {
- stream() << "\n";
+// Copyright 2009 The RE2 Authors. All Rights Reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#ifndef UTIL_LOGGING_H_
+#define UTIL_LOGGING_H_
+
+// Simplified version of Google's logging.
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ostream>
+#include <sstream>
+
+#include "util/util.h"
+
+// Debug-only checking.
+#define DCHECK(condition) assert(condition)
+#define DCHECK_EQ(val1, val2) assert((val1) == (val2))
+#define DCHECK_NE(val1, val2) assert((val1) != (val2))
+#define DCHECK_LE(val1, val2) assert((val1) <= (val2))
+#define DCHECK_LT(val1, val2) assert((val1) < (val2))
+#define DCHECK_GE(val1, val2) assert((val1) >= (val2))
+#define DCHECK_GT(val1, val2) assert((val1) > (val2))
+
+// Always-on checking
+#define CHECK(x) if(x){}else LogMessageFatal(__FILE__, __LINE__).stream() << "Check failed: " #x
+#define CHECK_LT(x, y) CHECK((x) < (y))
+#define CHECK_GT(x, y) CHECK((x) > (y))
+#define CHECK_LE(x, y) CHECK((x) <= (y))
+#define CHECK_GE(x, y) CHECK((x) >= (y))
+#define CHECK_EQ(x, y) CHECK((x) == (y))
+#define CHECK_NE(x, y) CHECK((x) != (y))
+
+#define LOG_INFO LogMessage(__FILE__, __LINE__)
+#define LOG_WARNING LogMessage(__FILE__, __LINE__)
+#define LOG_ERROR LogMessage(__FILE__, __LINE__)
+#define LOG_FATAL LogMessageFatal(__FILE__, __LINE__)
+#define LOG_QFATAL LOG_FATAL
+
+// It seems that one of the Windows header files defines ERROR as 0.
+#ifdef _WIN32
+#define LOG_0 LOG_INFO
+#endif
+
+#ifdef NDEBUG
+#define LOG_DFATAL LOG_ERROR
+#else
+#define LOG_DFATAL LOG_FATAL
+#endif
+
+#define LOG(severity) LOG_ ## severity.stream()
+
+#define VLOG(x) if((x)>0){}else LOG_INFO.stream()
+
+class LogMessage {
+ public:
+ LogMessage(const char* file, int line)
+ : flushed_(false) {
+ stream() << file << ":" << line << ": ";
+ }
+ void Flush() {
+ stream() << "\n";
std::string s = str_.str();
- size_t n = s.size();
- if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc
- flushed_ = true;
- }
- ~LogMessage() {
- if (!flushed_) {
- Flush();
- }
- }
- std::ostream& stream() { return str_; }
-
- private:
- bool flushed_;
- std::ostringstream str_;
-
- LogMessage(const LogMessage&) = delete;
- LogMessage& operator=(const LogMessage&) = delete;
-};
-
-// Silence "destructor never returns" warning for ~LogMessageFatal().
-// Since this is a header file, push and then pop to limit the scope.
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4722)
-#endif
-
-class LogMessageFatal : public LogMessage {
- public:
- LogMessageFatal(const char* file, int line)
- : LogMessage(file, line) {}
+ size_t n = s.size();
+ if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc
+ flushed_ = true;
+ }
+ ~LogMessage() {
+ if (!flushed_) {
+ Flush();
+ }
+ }
+ std::ostream& stream() { return str_; }
+
+ private:
+ bool flushed_;
+ std::ostringstream str_;
+
+ LogMessage(const LogMessage&) = delete;
+ LogMessage& operator=(const LogMessage&) = delete;
+};
+
+// Silence "destructor never returns" warning for ~LogMessageFatal().
+// Since this is a header file, push and then pop to limit the scope.
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 4722)
+#endif
+
+class LogMessageFatal : public LogMessage {
+ public:
+ LogMessageFatal(const char* file, int line)
+ : LogMessage(file, line) {}
ATTRIBUTE_NORETURN ~LogMessageFatal() {
- Flush();
- abort();
- }
- private:
- LogMessageFatal(const LogMessageFatal&) = delete;
- LogMessageFatal& operator=(const LogMessageFatal&) = delete;
-};
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif // UTIL_LOGGING_H_
+ Flush();
+ abort();
+ }
+ private:
+ LogMessageFatal(const LogMessageFatal&) = delete;
+ LogMessageFatal& operator=(const LogMessageFatal&) = delete;
+};
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif // UTIL_LOGGING_H_