Commit 896f9c23 authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

cppgc: fix sourceLocation test on gcc

This test produces different outputs when compiled with
gcc. It is currently failing on PPC using gcc-8, it also has
failed on riscv: https://github.com/riscv/v8/issues/174

I have also tested it with gcc-10 on x64 and it still fails.
The line numbers seem to be different when compiled with gcc
instead of clang.

As a workaround we can force the usage of macros in one line
to assure outputs are the same on either compiler.

Change-Id: I36a05d0dc62dfe66bdfcf177422836cb231284b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2844666Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#74162}
parent e9c6e931
......@@ -63,13 +63,11 @@ TEST(LoggingTest, Message) {
TEST(LoggingTest, SourceLocation) {
using ::testing::AllOf;
using ::testing::HasSubstr;
// clang-format off
constexpr auto loc = SourceLocation::Current();
EXPECT_DEATH_IF_SUPPORTED(CPPGC_DCHECK(false),
AllOf(HasSubstr(loc.FileName()),
HasSubstr(std::to_string(loc.Line() + 3))));
EXPECT_DEATH_IF_SUPPORTED(CPPGC_CHECK(false),
AllOf(HasSubstr(loc.FileName()),
HasSubstr(std::to_string(loc.Line() + 6))));
EXPECT_DEATH_IF_SUPPORTED(CPPGC_DCHECK(false), AllOf(HasSubstr(loc.FileName()), HasSubstr(std::to_string(loc.Line() + 1)))); // NOLINT(whitespace/line_length)
EXPECT_DEATH_IF_SUPPORTED(CPPGC_CHECK(false), AllOf(HasSubstr(loc.FileName()), HasSubstr(std::to_string(loc.Line() + 2)))); // NOLINT(whitespace/line_length)
// clang-format on
}
#endif // CPPGC_SUPPORTS_SOURCE_LOCATION
......
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