From eef00ba7e52842a05cc6aae4faadfed95ed498e7 Mon Sep 17 00:00:00 2001 From: David Machaj <46852402+dmachaj@users.noreply.github.com> Date: Thu, 22 Jun 2023 09:23:51 -0700 Subject: [PATCH 1/3] Fix cpp20 source location test failure resulting from newer compiler --- test/test_cpp20/custom_error.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_cpp20/custom_error.cpp b/test/test_cpp20/custom_error.cpp index 2714fa837..0986dd4d5 100644 --- a/test/test_cpp20/custom_error.cpp +++ b/test/test_cpp20/custom_error.cpp @@ -66,7 +66,7 @@ TEST_CASE("custom_error_logger") #elif defined(__GNUC__) && defined(__clang__) REQUIRE(functionNameSv == "void (anonymous namespace)::FailOnLine15()"); #else - REQUIRE(functionNameSv == "FailOnLine15"); + REQUIRE(functionNameSv == "void __cdecl `anonymous-namespace'::FailOnLine15(void)"); #endif REQUIRE(s_loggerArgs.returnAddress); From 6bf984ab0d9e2dac8ecef5da46c2cbb53e65d0db Mon Sep 17 00:00:00 2001 From: David Machaj <46852402+dmachaj@users.noreply.github.com> Date: Thu, 22 Jun 2023 09:55:58 -0700 Subject: [PATCH 2/3] Match function name substring instead of the entire signature. Should be more stable over time --- test/test_cpp20/custom_error.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/test_cpp20/custom_error.cpp b/test/test_cpp20/custom_error.cpp index 0986dd4d5..1a9b0a105 100644 --- a/test/test_cpp20/custom_error.cpp +++ b/test/test_cpp20/custom_error.cpp @@ -61,13 +61,10 @@ TEST_CASE("custom_error_logger") REQUIRE(fileNameSv.find("custom_error.cpp") != std::string::npos); const auto functionNameSv = std::string_view(s_loggerArgs.functionName); REQUIRE(!functionNameSv.empty()); -#if defined(__GNUC__) && !defined(__clang__) - REQUIRE(functionNameSv == "void {anonymous}::FailOnLine15()"); -#elif defined(__GNUC__) && defined(__clang__) - REQUIRE(functionNameSv == "void (anonymous namespace)::FailOnLine15()"); -#else - REQUIRE(functionNameSv == "void __cdecl `anonymous-namespace'::FailOnLine15(void)"); -#endif + // Every compiler has a slightly different naming approach for this function, and even the same + // compiler can change its mind over time. Instead of matching the entire function name just + // match against the part we care about. + REQUIRE(functionNameSv.find("FailOnLine15" != std::string_view::npos)); REQUIRE(s_loggerArgs.returnAddress); REQUIRE(s_loggerArgs.result == static_cast(0x80000018)); // E_ILLEGAL_DELEGATE_ASSIGNMENT) From 2a6a4f0df407112cfdc6d120cf41c4f20e41bafb Mon Sep 17 00:00:00 2001 From: David Machaj <46852402+dmachaj@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:09:59 -0700 Subject: [PATCH 3/3] Fix sloppy misplaced parenthesis --- test/test_cpp20/custom_error.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_cpp20/custom_error.cpp b/test/test_cpp20/custom_error.cpp index 1a9b0a105..34a0ea38f 100644 --- a/test/test_cpp20/custom_error.cpp +++ b/test/test_cpp20/custom_error.cpp @@ -64,7 +64,7 @@ TEST_CASE("custom_error_logger") // Every compiler has a slightly different naming approach for this function, and even the same // compiler can change its mind over time. Instead of matching the entire function name just // match against the part we care about. - REQUIRE(functionNameSv.find("FailOnLine15" != std::string_view::npos)); + REQUIRE((functionNameSv.find("FailOnLine15") != std::string_view::npos)); REQUIRE(s_loggerArgs.returnAddress); REQUIRE(s_loggerArgs.result == static_cast(0x80000018)); // E_ILLEGAL_DELEGATE_ASSIGNMENT)