Commit ce1d3484 by Andy Getzendanner Committed by Copybara-Service

Narrow some _MSC_VER checks to not catch clang-cl.

PiperOrigin-RevId: 486227733
Change-Id: If492d715e5758971cf7bd0ccd748b47b1424a3c7
parent 32e928d2
......@@ -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
......
......@@ -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
};
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment