From aebdfd605162f3fa85388fabf57b63b3b56bfe48 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Sun, 8 Oct 2023 18:56:34 +0200 Subject: [PATCH] fix: eliminate msvc warning --- src/glog/logging.h.in | 21 ++++++--------------- src/logging.cc | 8 ++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in index 79e7a17..0a7ebd2 100644 --- a/src/glog/logging.h.in +++ b/src/glog/logging.h.in @@ -1780,11 +1780,11 @@ class GLOG_EXPORT NullStream : public LogMessage::LogStream { // (they'll never be actually displayed). This will be needed if a // NullStream& is implicitly converted to LogStream&, in which case // the overloaded NullStream::operator<< will not be invoked. - NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) { } + NullStream(); NullStream(const char* /*file*/, int /*line*/, - const CheckOpString& /*result*/) : - LogMessage::LogStream(message_buffer_, 1, 0) { } - NullStream &stream() { return *this; } + const CheckOpString& /*result*/); + NullStream& stream(); + private: // A very short buffer for messages (which we discard anyway). This // will be needed if NullStream& converted to LogStream& (e.g. as a @@ -1805,17 +1805,8 @@ inline NullStream& operator<<(NullStream &str, const T &) { return str; } // trace), like LogMessageFatal. class GLOG_EXPORT NullStreamFatal : public NullStream { public: - NullStreamFatal() { } - NullStreamFatal(const char* file, int line, const CheckOpString& result) : - NullStream(file, line, result) { } -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4722) -#endif // _MSC_VER - [[noreturn]] ~NullStreamFatal() throw() { _exit(EXIT_FAILURE); } -#if defined(_MSC_VER) -#pragma warning(pop) -#endif // _MSC_VER + using NullStream::NullStream; + [[noreturn]] ~NullStreamFatal(); }; // Install a signal handler that will dump signal information and a stack diff --git a/src/logging.cc b/src/logging.cc index 719ee0f..23295f5 100644 --- a/src/logging.cc +++ b/src/logging.cc @@ -1931,6 +1931,14 @@ void LogMessage::RecordCrashReason( GLOG_EXPORT logging_fail_func_t g_logging_fail_func = reinterpret_cast(&abort); +NullStream::NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) {} +NullStream::NullStream(const char* /*file*/, int /*line*/, + const CheckOpString& /*result*/) + : LogMessage::LogStream(message_buffer_, 1, 0) {} +NullStream& NullStream::stream() { return *this; } + +NullStreamFatal::~NullStreamFatal() { _exit(EXIT_FAILURE); } + void InstallFailureFunction(logging_fail_func_t fail_func) { g_logging_fail_func = fail_func; }