diff --git a/absl/log/internal/log_message.cc b/absl/log/internal/log_message.cc index 82833af0..f32c7e63 100644 --- a/absl/log/internal/log_message.cc +++ b/absl/log/internal/log_message.cc @@ -467,7 +467,7 @@ LogMessageFatal::LogMessageFatal(const char* file, int line, // ABSL_ATTRIBUTE_NORETURN doesn't seem to work on destructors with msvc, so // disable msvc's warning about the d'tor never returning. -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) #pragma warning(disable : 4722) #endif @@ -475,7 +475,7 @@ LogMessageFatal::~LogMessageFatal() { Flush(); FailWithoutStackTrace(); } -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(pop) #endif @@ -493,7 +493,7 @@ LogMessageQuietlyFatal::LogMessageQuietlyFatal(const char* file, int line, // ABSL_ATTRIBUTE_NORETURN doesn't seem to work on destructors with msvc, so // disable msvc's warning about the d'tor never returning. -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) #pragma warning(disable : 4722) #endif @@ -501,7 +501,7 @@ LogMessageQuietlyFatal::~LogMessageQuietlyFatal() { Flush(); FailQuietly(); } -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(pop) #endif diff --git a/absl/log/internal/nullstream.h b/absl/log/internal/nullstream.h index 80c62c9e..8ed63d52 100644 --- a/absl/log/internal/nullstream.h +++ b/absl/log/internal/nullstream.h @@ -117,12 +117,12 @@ class NullStreamFatal final : public NullStream { NullStreamFatal() {} // ABSL_ATTRIBUTE_NORETURN doesn't seem to work on destructors with msvc, so // disable msvc's warning about the d'tor never returning. -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) #pragma warning(disable : 4722) #endif ABSL_ATTRIBUTE_NORETURN ~NullStreamFatal() { _exit(1); } -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) #pragma warning(pop) #endif }; diff --git a/absl/log/log_format_test.cc b/absl/log/log_format_test.cc index 397c8d0c..f88650fe 100644 --- a/absl/log/log_format_test.cc +++ b/absl/log/log_format_test.cc @@ -648,13 +648,15 @@ TYPED_TEST(VoidPtrLogFormatTest, NonNull) { auto comparison_stream = ComparisonStream(); comparison_stream << value; - EXPECT_CALL(test_sink, - Send(AllOf(TextMessage(MatchesOstream(comparison_stream)), - TextMessage(AnyOf(Eq("0xdeadbeef"), Eq("DEADBEEF"), - Eq("00000000DEADBEEF"))), - ENCODED_MESSAGE(EqualsProto(R"pb(value { - str: "0xdeadbeef" - })pb"))))); + EXPECT_CALL( + test_sink, + Send(AllOf( + TextMessage(MatchesOstream(comparison_stream)), + TextMessage( + AnyOf(Eq("0xdeadbeef"), Eq("DEADBEEF"), Eq("00000000DEADBEEF"))), + ENCODED_MESSAGE(AnyOf( + EqualsProto(R"pb(value { str: "0xdeadbeef" })pb"), + EqualsProto(R"pb(value { str: "00000000DEADBEEF" })pb")))))); test_sink.StartCapturingLogs(); LOG(INFO) << value; @@ -1286,8 +1288,11 @@ TEST(ManipulatorLogFormatTest, FixedAndScientificFloat) { Send(AllOf(TextMessage(MatchesOstream(comparison_stream)), TextMessage(AnyOf(Eq("0x1.25bb50p+26"), Eq("0x1.25bb5p+26"), Eq("0x1.25bb500000000p+26"))), - ENCODED_MESSAGE(EqualsProto(R"pb( - value { str: "0x1.25bb5p+26" })pb"))))); + ENCODED_MESSAGE( + AnyOf(EqualsProto(R"pb(value { str: "0x1.25bb5p+26" })pb"), + EqualsProto(R"pb(value { + str: "0x1.25bb500000000p+26" + })pb")))))); test_sink.StartCapturingLogs(); @@ -1316,8 +1321,11 @@ TEST(ManipulatorLogFormatTest, HexfloatFloat) { Send(AllOf(TextMessage(MatchesOstream(comparison_stream)), TextMessage(AnyOf(Eq("0x1.25bb50p+26"), Eq("0x1.25bb5p+26"), Eq("0x1.25bb500000000p+26"))), - ENCODED_MESSAGE(EqualsProto(R"pb( - value { str: "0x1.25bb5p+26" })pb"))))); + ENCODED_MESSAGE( + AnyOf(EqualsProto(R"pb(value { str: "0x1.25bb5p+26" })pb"), + EqualsProto(R"pb(value { + str: "0x1.25bb500000000p+26" + })pb")))))); test_sink.StartCapturingLogs(); LOG(INFO) << std::hexfloat << value; diff --git a/absl/log/stripping_test.cc b/absl/log/stripping_test.cc index 83dfc2dc..d6a6606e 100644 --- a/absl/log/stripping_test.cc +++ b/absl/log/stripping_test.cc @@ -327,7 +327,7 @@ TEST_F(StrippingTest, Level) { // level that shouldn't be stripped. EXPECT_THAT(exe.get(), FileHasSubstr(needle)); } else { -#if defined(_MSC_VER) || defined(__APPLE__) +#if (defined(_MSC_VER) && !defined(__clang__)) || defined(__APPLE__) // Dead code elimination misses this case. #else // All levels should be stripped, so it doesn't matter what the severity